4 salome.salome_init_without_session()
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New()
10 from salome.smesh import smeshBuilder
11 smesh = smeshBuilder.New()
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, "box")
19 localAlgo = mesh.Triangle(face)
20 mesh.Segment().NumberOfSegments( 3 )
26 fGroup = mesh.GroupOnGeom( face, "2D on face")
27 nGroup = mesh.GroupOnGeom( face, "nodes on face", SMESH.NODE)
28 subMesh = localAlgo.GetSubMesh()
30 # make a new mesh by copying different parts of the mesh
32 # 1. copy the whole mesh
33 newMesh = smesh.CopyMesh( mesh, "whole mesh copy")
35 # 2. copy a group of 2D elements along with groups
36 newMesh = smesh.CopyMesh( fGroup, "face group copy with groups",toCopyGroups=True)
38 # 3. copy a group of nodes
39 newMesh = smesh.CopyMesh( nGroup, "node group copy")
42 faceIds = fGroup.GetIDs()[-10:]
43 newMesh = smesh.CopyMesh( mesh.GetIDSource( faceIds, SMESH.FACE ), "some faces copy")
46 nodeIds = nGroup.GetIDs()[-10:]
47 newMesh = smesh.CopyMesh( mesh.GetIDSource( nodeIds, SMESH.NODE), "some nodes copy")
50 newMesh = smesh.CopyMesh( subMesh, "sub-mesh copy" )
53 # make a new mesh with same hypotheses on a modified geometry
55 smallBox = geompy.MakeScaleAlongAxes( box, None, 1, 0.5, 0.5 )
56 cutBox = geompy.MakeCut( box, smallBox, theName="box - smallBox" )
58 ok, newMesh, groups, submehses, hyps, invIDs = smesh.CopyMeshWithGeom( mesh, cutBox, "cutBox" )