Salome HOME
1) fix Mesh.__init__(): do not overwrite given mesh name by name of not published...
authoreap <eap@opencascade.com>
Fri, 11 Mar 2011 10:13:41 +0000 (10:13 +0000)
committereap <eap@opencascade.com>
Fri, 11 Mar 2011 10:13:41 +0000 (10:13 +0000)
2) 020749: EDF 1291 SMESH : Create 2D Mesh from 3D improvement

+    def MakeBoundaryElements()

src/SMESH_SWIG/smeshDC.py

index f32b4ab811914f3111bc9511310f2883a72a7265..162558018bcf3347f875a805fb879789c8ba055d 100644 (file)
@@ -1091,8 +1091,8 @@ class Mesh:
                     if studyID != geompyD.myStudyId:
                         geompyD.init_geom( smeshpyD.GetCurrentStudy())
                         pass
-                    name = "%s_%s"%(self.geom.GetShapeType(), id(self.geom)%100)
-                    geompyD.addToStudy( self.geom, name )
+                    geo_name = "%s_%s"%(self.geom.GetShapeType(), id(self.geom)%100)
+                    geompyD.addToStudy( self.geom, geo_name )
                 self.mesh = self.smeshpyD.CreateMesh(self.geom)
 
             elif isinstance(obj, SMESH._objref_SMESH_Mesh):
@@ -3109,6 +3109,30 @@ class Mesh:
         if mesh: mesh = self.smeshpyD.Mesh(mesh)
         return mesh, group
 
+    ##
+    # @brief Creates missing boundary elements around either the whole mesh or 
+    #    groups of 2D elements
+    #  @param dimension - defines type of boundary elements to create
+    #  @param groupName - a name of group to store all boundary elements in,
+    #    "" means not to create the group
+    #  @param meshName - a name of a new mesh, which is a copy of the initial 
+    #    mesh + created boundary elements; "" means not to create the new mesh
+    #  @param toCopyAll - if true, the whole initial mesh will be copied into
+    #    the new mesh else only boundary elements will be copied into the new mesh
+    #  @param groups - groups of 2D elements to make boundary around
+    #    the new mesh else only boundary elements will be copied into the new mesh
+    #  @retval tuple( long, mesh, groups )
+    #                 long - number of added boundary elements
+    #                 mesh - the mesh where elements were added to
+    #                 group - the group of boundary elements or None
+    #
+    def MakeBoundaryElements(self, dimension=SMESH.BND_2DFROM3D, groupName="", meshName="",
+                             toCopyAll=False, groups=[]):
+        nb, mesh, group = self.editor.MakeBoundaryElements(dimension,groupName,meshName,
+                                                           toCopyAll,groups)
+        if mesh: mesh = self.smeshpyD.Mesh(mesh)
+        return nb, mesh, group
+
     ## Renumber mesh nodes
     #  @ingroup l2_modif_renumber
     def RenumberNodes(self):