]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
bos #20543 EDF 22638 - hyperpatch with CADSurf
authoreap <eap@opencascade.com>
Wed, 27 Jan 2021 10:10:14 +0000 (13:10 +0300)
committereap <eap@opencascade.com>
Wed, 27 Jan 2021 10:10:14 +0000 (13:10 +0300)
A nice solution for pb of dealing with SHAPERSTUDY objects has been found

src/SMESH_SWIG/smeshBuilder.py
src/SMESH_SWIG/smesh_algorithm.py

index c99e958214e6c0d16b649cb24eeb24c9e4cf9d11..7bdc59eb4b2d63676e953e9f17e9e98f576072b7 100644 (file)
@@ -1651,7 +1651,17 @@ class Mesh(metaclass = MeshMeta):
             #self.mesh.Register()
             self.geom = self.mesh.GetShapeToMesh()
             if self.geom:
-                self.geompyD = self.geom.GetGen()
+                self.geompyD = None
+                try:
+                    so = salome.ObjectToSObject( self.geom )
+                    comp = so.GetFatherComponent()
+                    if comp.ComponentDataType() == "SHAPERSTUDY":
+                        import shaperBuilder
+                        self.geompyD = shaperBuilder.New()
+                except:
+                    pass
+                if not self.geompyD:
+                    self.geompyD = self.geom.GetGen()
                 pass
         pass
 
@@ -2642,15 +2652,7 @@ class Mesh(metaclass = MeshMeta):
         elif tgeo == "SOLID" or tgeo == "COMPSOLID":
             typ = VOLUME
         elif tgeo == "COMPOUND":
-            try:
-              sub = self.geompyD.SubShapeAll( shape, self.geompyD.ShapeType["SHAPE"])
-            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:
-                sub = gen.GetIShapesOperations().ExtractSubShapes(shape, self.geompyD.ShapeType["SHAPE"], False)
+            sub = self.geompyD.SubShapeAll( shape, self.geompyD.ShapeType["SHAPE"])
             if not sub:
                 raise ValueError("_groupTypeFromShape(): empty geometric group or compound '%s'" % GetName(shape))
             return self._groupTypeFromShape( sub[0] )
index e9867dc4e3d9ba6ebe0c079f8fe6e2a1efff931d..62495cc4917b889e4011785701970aae8fd03128 100644 (file)
@@ -340,20 +340,9 @@ class Mesh_Algorithm:
         if faces and isinstance( faces[0], geomBuilder.GEOM._objref_GEOM_Object ):
             faceIDs = []
             for shape in faces:
-                try:
-                  ff = self.mesh.geompyD.SubShapeAll( shape, self.mesh.geompyD.ShapeType["FACE"] )
-                  for f in ff:
+                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],
@@ -403,20 +392,9 @@ 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],
@@ -440,18 +418,6 @@ 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 )