6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
13 # make geometry of a box
14 box = geompy.MakeBoxDXDYDZ(100,100,100)
15 face = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0]
17 # generate a prismatic 3D mesh
18 mesh = smesh.Mesh(box)
19 localAlgo = mesh.Triangle(face)
20 mesh.AutomaticHexahedralization()
23 fGroup = mesh.GroupOnGeom( face, "2D on face")
24 nGroup = mesh.GroupOnGeom( face, "nodes on face", SMESH.NODE)
25 subMesh = localAlgo.GetSubMesh()
27 # make a new mesh by copying different parts of the mesh
29 # 1. copy the whole mesh
30 newMesh = smesh.CopyMesh( mesh, "whole mesh copy")
32 # 2. copy a group of 2D elements along with groups
33 newMesh = smesh.CopyMesh( fGroup, "face group copy with groups",toCopyGroups=True)
35 # 3. copy a group of nodes
36 newMesh = smesh.CopyMesh( nGroup, "node group copy")
39 faceIds = fGroup.GetIDs()[-10:]
40 newMesh = smesh.CopyMesh( mesh.GetIDSource( faceIds, SMESH.FACE ), "some faces copy")
43 nodeIds = nGroup.GetIDs()[-10:]
44 newMesh = smesh.CopyMesh( mesh.GetIDSource( nodeIds, SMESH.NODE), "some nodes copy")
47 newMesh = smesh.CopyMesh( subMesh, "sub-mesh copy" )