Salome HOME
simplification
[modules/smesh.git] / src / SMESH_SWIG / smeshBuilder.py
index b40bc6d1eea57f812cdb8ec5e10a3d48313cd31e..fcb05ab6326e43a98a3027de6303fb2beaaa292f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -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
 
@@ -1952,9 +1962,10 @@ class Mesh(metaclass = MeshMeta):
                 print(msg)
                 print(allReasons)
             pass
-        if salome.sg.hasDesktop():
-            if not isinstance( refresh, list): # not a call from subMesh.Compute()
-                if refresh: salome.sg.updateObjBrowser()
+        if salome.sg:
+            if salome.sg.hasDesktop():
+                if not isinstance( refresh, list): # not a call from subMesh.Compute()
+                    if refresh: salome.sg.updateObjBrowser()
 
         return ok
 
@@ -2642,15 +2653,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] )
@@ -4450,7 +4453,7 @@ class Mesh(metaclass = MeshMeta):
 
         Returns:
              A list of edge groups and a list of corresponding node groups,
-             where the group is a list of IDs of edges or elements, like follows
+             where the group is a list of IDs of edges or nodes, like follows
              [[[branch_edges_1],[branch_edges_2]], [[branch_nodes_1],[branch_nodes_2]]].
              If a group is closed, the first and last nodes of the group are same.
         """