X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_SWIG%2FsmeshDC.py;h=74ad2f65fcc7b5b9f2bcf2537dce32afc08d5866;hb=20ce0ddfa84bbabf932ef373d1555671244a31b5;hp=72caa26be295dd4cd264f9b188a43212e5f308a1;hpb=6f15d8202ed426757756183fbc770ac5c718ad21;p=modules%2Fsmesh.git diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index 72caa26be..74ad2f65f 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -1146,12 +1146,25 @@ class Mesh: ## Gets the subMesh object associated to a \a theSubObject geometrical object. # The subMesh object gives access to the IDs of nodes and elements. - # @param theSubObject a geometrical object (shape) - # @param theName a name for the submesh + # @param geom a geometrical object (shape) + # @param name a name for the submesh # @return an object of type SMESH_SubMesh, representing a part of mesh, which lies on the given shape # @ingroup l2_submeshes - def GetSubMesh(self, theSubObject, theName): - submesh = self.mesh.GetSubMesh(theSubObject, theName) + def GetSubMesh(self, geom, name): + if not geom.IsSame( self.geom ) and not geom.GetStudyEntry(): + ## set the study + studyID = self.smeshpyD.GetCurrentStudy()._get_StudyId() + if studyID != self.geompyD.myStudyId: + self.geompyD.init_geom( self.smeshpyD.GetCurrentStudy()) + ## get a name + if not name and geom.GetShapeType() != geompyDC.GEOM.COMPOUND: + # for all groups SubShapeName() returns "Compound_-1" + name = self.geompyD.SubShapeName(geom, self.geom) + if not name: + name = "%s_%s"%(geom.GetShapeType(), id(geom)%10000) + ## publish + self.geompyD.addToStudyInFather( self.geom, geom, name ) + submesh = self.mesh.GetSubMesh( geom, name ) return submesh ## Returns the shape associated to the mesh