X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_SWIG%2Fsmesh_algorithm.py;h=e9867dc4e3d9ba6ebe0c079f8fe6e2a1efff931d;hb=HEAD;hp=3c60c3f64fc034d8853906a348a7060a377b2419;hpb=b24a2d1b7692bdb21cf037b026e0273ba547cef4;p=modules%2Fsmesh.git diff --git a/src/SMESH_SWIG/smesh_algorithm.py b/src/SMESH_SWIG/smesh_algorithm.py index 3c60c3f64..934b1235c 100644 --- a/src/SMESH_SWIG/smesh_algorithm.py +++ b/src/SMESH_SWIG/smesh_algorithm.py @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -340,9 +340,20 @@ class Mesh_Algorithm: if faces and isinstance( faces[0], geomBuilder.GEOM._objref_GEOM_Object ): faceIDs = [] for shape in faces: - ff = self.mesh.geompyD.SubShapeAll( shape, self.mesh.geompyD.ShapeType["FACE"] ) - for f in ff: + try: + ff = self.mesh.geompyD.SubShapeAll( shape, self.mesh.geompyD.ShapeType["FACE"] ) + for f in ff: faceIDs.append( self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f)) + except: + # try to get the SHAPERSTUDY engine directly, because GetGen does not work because of + # simplification of access in geomBuilder: omniORB.registerObjref + from SHAPERSTUDY_utils import getEngine + gen = getEngine() + if gen: + aShapeOp = gen.GetIShapesOperations() + ff = aShapeOp.ExtractSubShapes( shape, self.mesh.geompyD.ShapeType["FACE"], False) + for f in ff: + faceIDs.append( aShapeOp.GetSubShapeIndex( self.mesh.geom, f )) faces = faceIDs hyp = self.Hypothesis("ViscousLayers", [thickness, numberOfLayers, stretchFactor, faces, isFacesToIgnore], @@ -361,7 +372,7 @@ class Mesh_Algorithm: """ Defines "ViscousLayers2D" hypothesis to give parameters of layers of quadrilateral elements to build near mesh boundary. This hypothesis can be used by several 2D algorithms: - NETGEN 2D, NETGEN 1D-2D, Quadrangle (mapping), MEFISTO, MG-CADSurf + NETGEN 2D, NETGEN 1D-2D, Quadrangle (mapping), MG-CADSurf Parameters: thickness: total thickness of layers of quadrilaterals @@ -392,9 +403,20 @@ class Mesh_Algorithm: if edges and isinstance( edges[0], geomBuilder.GEOM._objref_GEOM_Object ): edgeIDs = [] for shape in edges: + try: ee = self.mesh.geompyD.SubShapeAll( shape, self.mesh.geompyD.ShapeType["EDGE"]) for e in ee: edgeIDs.append( self.mesh.geompyD.GetSubShapeID( self.mesh.geom, e )) + except: + # try to get the SHAPERSTUDY engine directly, because GetGen does not work because of + # simplification of access in geomBuilder: omniORB.registerObjref + from SHAPERSTUDY_utils import getEngine + gen = getEngine() + if gen: + aShapeOp = gen.GetIShapesOperations() + ee = aShapeOp.ExtractSubShapes( shape, self.mesh.geompyD.ShapeType["EDGE"], False) + for e in ee: + edgeIDs.append( aShapeOp.GetSubShapeIndex( self.mesh.geom, e )) edges = edgeIDs hyp = self.Hypothesis("ViscousLayers2D", [thickness, numberOfLayers, stretchFactor, edges, isEdgesToIgnore], @@ -418,6 +440,18 @@ class Mesh_Algorithm: for i in reverseList: if isinstance( i, int ): s = geompy.GetSubShape(self.mesh.geom, [i]) + + #bos #20082 begin: + if s is None and type(self.geom) != geomBuilder.GEOM._objref_GEOM_Object: + # try to get the SHAPERSTUDY engine directly, as GetGen does not work because of + # simplification of access in geomBuilder: omniORB.registerObjref + from SHAPERSTUDY_utils import getEngine + gen = getEngine() + if gen: + aShapeOp = gen.GetIShapesOperations() + s = aShapeOp.GetSubShape(self.mesh.geom, i) + #bos #20082 end + if s.GetShapeType() != geomBuilder.GEOM.EDGE: raise TypeError("Not EDGE index given") resList.append( i )