Salome HOME
Synchronize with *_msg_en.ts
[modules/smesh.git] / src / SMESH_SWIG / smeshBuilder.py
index 9d583de0471c29b7342ae999ba0d109812168028..5e68dc230b7992786766b656063a8299b19e2ce2 100644 (file)
@@ -552,8 +552,8 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
         return aMeshes, aStatus
 
     ## Creates a Mesh object importing data from the given GMF file.
-    #  GMF files have .mesh extension for the ASCII format and .meshb for
-    #  the bynary format.
+    #  GMF files must have .mesh extension for the ASCII format and .meshb for
+    #  the binary format.
     #  @return [ an instance of Mesh class, SMESH.ComputeError ]
     #  @ingroup l2_impexp
     def CreateMeshesFromGMF( self, theFileName ):
@@ -1047,7 +1047,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
         return result
 
     ## Get sum of lengths of all 1D elements in the mesh object.
-    #  @param elemId obj mesh, submesh or group
+    #  @param obj mesh, submesh or group
     #  @return sum of lengths of all 1D elements
     #  @ingroup l1_measurements
     def GetLength(self, obj):
@@ -1059,7 +1059,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
         return value
 
     ## Get sum of areas of all 2D elements in the mesh object.
-    #  @param elemId obj mesh, submesh or group
+    #  @param obj mesh, submesh or group
     #  @return sum of areas of all 2D elements
     #  @ingroup l1_measurements
     def GetArea(self, obj):
@@ -1071,7 +1071,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
         return value
 
     ## Get sum of volumes of all 3D elements in the mesh object.
-    #  @param elemId obj mesh, submesh or group
+    #  @param obj mesh, submesh or group
     #  @return sum of volumes of all 3D elements
     #  @ingroup l1_measurements
     def GetVolume(self, obj):
@@ -1176,12 +1176,12 @@ class Mesh:
                     else:
                         geo_name = "%s_%s to mesh"%(self.geom.GetShapeType(), id(self.geom)%100)
                     geompyD.addToStudy( self.geom, geo_name )
-                self.mesh = self.smeshpyD.CreateMesh(self.geom)
+                self.SetMesh( self.smeshpyD.CreateMesh(self.geom) )
 
             elif isinstance(obj, SMESH._objref_SMESH_Mesh):
                 self.SetMesh(obj)
         else:
-            self.mesh = self.smeshpyD.CreateEmptyMesh()
+            self.SetMesh( self.smeshpyD.CreateEmptyMesh() )
         if name:
             self.smeshpyD.SetName(self.mesh, name)
         elif objHasName:
@@ -1199,16 +1199,28 @@ class Mesh:
             if isinstance( attr, algoCreator ):
                 #print "algoCreator ", attrName
                 setattr( self, attrName, attr.copy( self ))
+                pass
+            pass
+        pass
 
+    ## Destructor. Clean-up resources
+    def __del__(self):
+        if self.mesh:
+            #self.mesh.UnRegister()
+            pass
+        pass
+        
     ## Initializes the Mesh object from an instance of SMESH_Mesh interface
     #  @param theMesh a SMESH_Mesh object
     #  @ingroup l2_construct
     def SetMesh(self, theMesh):
-        if self.mesh: self.mesh.UnRegister()
+        # do not call Register() as this prevents mesh servant deletion at closing study
+        #if self.mesh: self.mesh.UnRegister()
         self.mesh = theMesh
         if self.mesh:
-            self.mesh.Register()
+            #self.mesh.Register()
             self.geom = self.mesh.GetShapeToMesh()
+        pass
 
     ## Returns the mesh, that is an instance of SMESH_Mesh interface
     #  @return a SMESH_Mesh object
@@ -3285,7 +3297,7 @@ class Mesh:
     #     the new mesh else only boundary elements will be copied into the new mesh
     #  @param toCopyExistingBondary - if true, not only new but also pre-existing
     #     boundary elements will be copied into the new mesh
-    #  @return tuple (mesh, group) where bondary elements were added to
+    #  @return tuple (mesh, group) where boundary elements were added to
     #  @ingroup l2_modif_edit
     def MakeBoundaryMesh(self, elements, dimension=SMESH.BND_2DFROM3D, groupName="", meshName="",
                          toCopyElements=False, toCopyExistingBondary=False):
@@ -4105,9 +4117,9 @@ class Mesh:
         self.mesh.SetParameters(Parameters)
         return Mesh( self.smeshpyD, self.geompyD, mesh )
 
-    ## Finds groups of ajacent nodes within Tolerance.
+    ## Finds groups of adjacent nodes within Tolerance.
     #  @param Tolerance the value of tolerance
-    #  @return the list of groups of nodes
+    #  @return the list of pairs of nodes IDs (e.g. [[1,12],[25,4]])
     #  @ingroup l2_modif_trsf
     def FindCoincidentNodes (self, Tolerance):
         return self.editor.FindCoincidentNodes(Tolerance)
@@ -4116,7 +4128,7 @@ class Mesh:
     #  @param Tolerance the value of tolerance
     #  @param SubMeshOrGroup SubMesh or Group
     #  @param exceptNodes list of either SubMeshes, Groups or node IDs to exclude from search
-    #  @return the list of groups of nodes
+    #  @return the list of pairs of nodes IDs (e.g. [[1,12],[25,4]])
     #  @ingroup l2_modif_trsf
     def FindCoincidentNodesOnPart (self, SubMeshOrGroup, Tolerance, exceptNodes=[]):
         unRegister = genObjUnRegister()
@@ -4130,14 +4142,14 @@ class Mesh:
         return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,exceptNodes)
 
     ## Merges nodes
-    #  @param GroupsOfNodes the list of groups of nodes
+    #  @param GroupsOfNodes a list of pairs of nodes IDs for merging (e.g. [[1,12],[25,4]])
     #  @ingroup l2_modif_trsf
     def MergeNodes (self, GroupsOfNodes):
         self.editor.MergeNodes(GroupsOfNodes)
 
     ## Finds the elements built on the same nodes.
     #  @param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching
-    #  @return a list of groups of equal elements
+    #  @return the list of pairs of equal elements IDs (e.g. [[1,12],[25,4]])
     #  @ingroup l2_modif_trsf
     def FindEqualElements (self, MeshOrSubMeshOrGroup):
         if ( isinstance( MeshOrSubMeshOrGroup, Mesh )):
@@ -4145,7 +4157,7 @@ class Mesh:
         return self.editor.FindEqualElements(MeshOrSubMeshOrGroup)
 
     ## Merges elements in each given group.
-    #  @param GroupsOfElementsID groups of elements for merging
+    #  @param GroupsOfElementsID a list of pairs of elements IDs for merging (e.g. [[1,12],[25,4]])
     #  @ingroup l2_modif_trsf
     def MergeElements(self, GroupsOfElementsID):
         self.editor.MergeElements(GroupsOfElementsID)
@@ -4643,7 +4655,8 @@ for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ):
     try:
         exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName))
     except Exception, e:
-        print "Exception while loading %s: %s" % ( pluginBuilderName, e )
+       from salome_utils import verbose
+       if verbose(): print "Exception while loading %s: %s" % ( pluginBuilderName, e )
         continue
     exec( "from salome.%s import %s" % (pluginName, pluginBuilderName))
     plugin = eval( pluginBuilderName )