Salome HOME
23315: [CEA 1929] Too much memory used to display a mesh in shading and wireframe
[modules/smesh.git] / src / SMESH_SWIG / smeshBuilder.py
index a37bffc803646fe4721540ff93347b086bd5b76a..47146139fa0c16b943fc66c86d09b71c6850ea53 100644 (file)
@@ -964,6 +964,10 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
             functor = aFilterMgr.CreateLength()
         elif theCriterion == FT_Length2D:
             functor = aFilterMgr.CreateLength2D()
+        elif theCriterion == FT_NodeConnectivityNumber:
+            functor = aFilterMgr.CreateNodeConnectivityNumber()
+        elif theCriterion == FT_BallDiameter:
+            functor = aFilterMgr.CreateBallDiameter()
         else:
             print "Error: given parameter is not numerical functor type."
         aFilterMgr.UnRegister()
@@ -1501,7 +1505,7 @@ class Mesh:
                 smeshgui = salome.ImportComponentGUI("SMESH")
                 smeshgui.Init(self.mesh.GetStudyId())
                 smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), ok, (self.NbNodes()==0) )
-                if refresh: salome.sg.updateObjBrowser(1)
+                if refresh: salome.sg.updateObjBrowser(True)
 
         return ok
 
@@ -1620,7 +1624,7 @@ class Mesh:
             smeshgui = salome.ImportComponentGUI("SMESH")
             smeshgui.Init(self.mesh.GetStudyId())
             smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
-            if refresh: salome.sg.updateObjBrowser(1)
+            if refresh: salome.sg.updateObjBrowser(True)
 
     ## Removes all nodes and elements of indicated shape
     #  @param refresh if @c True, Object browser is automatically updated (when running in GUI)
@@ -1632,7 +1636,7 @@ class Mesh:
             smeshgui = salome.ImportComponentGUI("SMESH")
             smeshgui.Init(self.mesh.GetStudyId())
             smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
-            if refresh: salome.sg.updateObjBrowser(1)
+            if refresh: salome.sg.updateObjBrowser(True)
 
     ## Computes a tetrahedral mesh using AutomaticLength + MEFISTO + Tetrahedron
     #  @param fineness [0.0,1.0] defines mesh fineness
@@ -2260,6 +2264,8 @@ class Mesh:
     #          idSrc.UnRegister()
     #  @ingroup l1_auxiliary
     def GetIDSource(self, ids, elemType = SMESH.ALL):
+        if isinstance( ids, int ):
+            ids = [ids]
         return self.editor.MakeIDSource(ids, elemType)
 
 
@@ -2512,7 +2518,7 @@ class Mesh:
         return self.mesh.GetElementShape(id)
 
     ## Returns the list of submesh elements IDs
-    #  @param Shape a geom object(sub-shape) IOR
+    #  @param Shape a geom object(sub-shape)
     #         Shape must be the sub-shape of a ShapeToMesh()
     #  @return the list of integer values
     #  @ingroup l1_meshinfo
@@ -2524,7 +2530,7 @@ class Mesh:
         return self.mesh.GetSubMeshElementsId(ShapeID)
 
     ## Returns the list of submesh nodes IDs
-    #  @param Shape a geom object(sub-shape) IOR
+    #  @param Shape a geom object(sub-shape)
     #         Shape must be the sub-shape of a ShapeToMesh()
     #  @param all If true, gives all nodes of submesh elements, otherwise gives only submesh nodes
     #  @return the list of integer values
@@ -2537,7 +2543,7 @@ class Mesh:
         return self.mesh.GetSubMeshNodesId(ShapeID, all)
 
     ## Returns type of elements on given shape
-    #  @param Shape a geom object(sub-shape) IOR
+    #  @param Shape a geom object(sub-shape)
     #         Shape must be a sub-shape of a ShapeToMesh()
     #  @return element type
     #  @ingroup l1_meshinfo
@@ -2824,10 +2830,11 @@ class Mesh:
 
     ## Creates a 0D element on a node with given number.
     #  @param IDOfNode the ID of node for creation of the element.
+    #  @param DuplicateElements to add one more 0D element to a node or not
     #  @return the Id of the new 0D element
     #  @ingroup l2_modif_add
-    def Add0DElement(self, IDOfNode):
-        return self.editor.Add0DElement(IDOfNode)
+    def Add0DElement( self, IDOfNode, DuplicateElements=True ):
+        return self.editor.Add0DElement( IDOfNode, DuplicateElements )
 
     ## Create 0D elements on all nodes of the given elements except those 
     #  nodes on which a 0D element already exists.
@@ -2836,18 +2843,19 @@ class Mesh:
     #         of nodes IDs created by calling mesh.GetIDSource( nodes, SMESH.NODE )
     #  @param theGroupName optional name of a group to add 0D elements created
     #         and/or found on nodes of \a theObject.
+    #  @param DuplicateElements to add one more 0D element to a node or not
     #  @return an object (a new group or a temporary SMESH_IDSource) holding
     #          IDs of new and/or found 0D elements. IDs of 0D elements 
     #          can be retrieved from the returned object by calling GetIDs()
     #  @ingroup l2_modif_add
-    def Add0DElementsToAllNodes(self, theObject, theGroupName=""):
+    def Add0DElementsToAllNodes(self, theObject, theGroupName="", DuplicateElements=False):
         unRegister = genObjUnRegister()
         if isinstance( theObject, Mesh ):
             theObject = theObject.GetMesh()
-        if isinstance( theObject, list ):
+        elif isinstance( theObject, list ):
             theObject = self.GetIDSource( theObject, SMESH.ALL )
             unRegister.set( theObject )
-        return self.editor.Create0DElementsOnAllNodes( theObject, theGroupName )
+        return self.editor.Create0DElementsOnAllNodes( theObject, theGroupName, DuplicateElements )
 
     ## Creates a ball element on a node with given ID.
     #  @param IDOfNode the ID of node for creation of the element.
@@ -4497,7 +4505,7 @@ class Mesh:
 
     ## Finds groups of ajacent nodes within Tolerance.
     #  @param Tolerance the value of tolerance
-    #  @param SubMeshOrGroup SubMesh or Group
+    #  @param SubMeshOrGroup SubMesh, Group or Filter
     #  @param exceptNodes list of either SubMeshes, Groups or node IDs to exclude from search
     #  @param SeparateCornerAndMediumNodes if @c True, in quadratic mesh puts
     #         corner and medium nodes in separate groups thus preventing
@@ -5043,7 +5051,7 @@ class submeshProxy(SMESH._objref_SMESH_subMesh):
             smeshgui = salome.ImportComponentGUI("SMESH")
             smeshgui.Init(self.mesh.GetStudyId())
             smeshgui.SetMeshIcon( salome.ObjectToID( self ), ok, (self.GetNumberOfElements()==0) )
-            if refresh: salome.sg.updateObjBrowser(1)
+            if refresh: salome.sg.updateObjBrowser(True)
             pass
 
         return ok