Salome HOME
Merge remote branch 'origin/V8_5_asterstudy'
[modules/smesh.git] / doc / salome / examples / creating_meshes_ex08.py
index a76e8d175fafa5fee68ac452c9201ed03327728f..7fa7a7dcffc3161a293aa5e6a3624c2c5608166e 100644 (file)
@@ -1,40 +1,47 @@
 # Mesh Copying
 
-from smesh import *
-SetCurrentStudy(salome.myStudy)
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh =  smeshBuilder.New()
 
 # make geometry of a box
 box = geompy.MakeBoxDXDYDZ(100,100,100)
 face = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0]
 
-# generate 3D mesh
-mesh = Mesh(box)
+# generate a prismatic 3D mesh
+mesh = smesh.Mesh(box)
 localAlgo = mesh.Triangle(face)
 mesh.AutomaticHexahedralization()
 
 # objects to copy
 fGroup = mesh.GroupOnGeom( face, "2D on face")
-nGroup = mesh.GroupOnGeom( face, "nodes on face", NODE)
+nGroup = mesh.GroupOnGeom( face, "nodes on face", SMESH.NODE)
 subMesh = localAlgo.GetSubMesh()
 
 # make a new mesh by copying different parts of the mesh
 
 # 1. copy the whole mesh
-newMesh = CopyMesh( mesh, "whole mesh copy")
+newMesh = smesh.CopyMesh( mesh, "whole mesh copy")
 
 # 2. copy a group of 2D elements along with groups
-newMesh = CopyMesh( fGroup,  "face group copy with groups",toCopyGroups=True)
+newMesh = smesh.CopyMesh( fGroup,  "face group copy with groups",toCopyGroups=True)
 
-# 3. copy a group of nodes with preseving their ids
-newMesh = CopyMesh( nGroup, "node group copy", toKeepIDs=True)
+# 3. copy a group of nodes
+newMesh = smesh.CopyMesh( nGroup, "node group copy")
 
 # 4. copy some faces
 faceIds = fGroup.GetIDs()[-10:]
-newMesh = CopyMesh( mesh.GetIDSource( faceIds, FACE ), "some faces copy")
+newMesh = smesh.CopyMesh( mesh.GetIDSource( faceIds, SMESH.FACE ), "some faces copy")
 
 # 5. copy some nodes
 nodeIds = nGroup.GetIDs()[-10:]
-newMesh = CopyMesh( mesh.GetIDSource( nodeIds, NODE), "some nodes copy")
+newMesh = smesh.CopyMesh( mesh.GetIDSource( nodeIds, SMESH.NODE), "some nodes copy")
 
 # 6. copy a sub-mesh
-newMesh = CopyMesh( subMesh, "submesh copy" )
+newMesh = smesh.CopyMesh( subMesh, "sub-mesh copy" )