1 # "Import 2D Elements from Another Mesh" example
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 a patritioned box
15 box = geompy.MakeBoxDXDYDZ(100,100,100)
17 N = geompy.MakeVectorDXDYDZ( 1,0,0 )
18 O = geompy.MakeVertex( 50,0,0 )
19 plane = geompy.MakePlane( O, N, 200 ) # plane YOZ
21 shape2boxes = geompy.MakeHalfPartition( box, plane )
22 boxes = geompy.SubShapeAllSorted(shape2boxes, geompy.ShapeType["SOLID"])
24 geompy.addToStudy( boxes[0], "boxes[0]")
25 geompy.addToStudy( boxes[1], "boxes[1]")
26 midFace0 = geompy.SubShapeAllSorted(boxes[0], geompy.ShapeType["FACE"])[5]
27 geompy.addToStudyInFather( boxes[0], midFace0, "middle Face")
28 midFace1 = geompy.SubShapeAllSorted(boxes[1], geompy.ShapeType["FACE"])[0]
29 geompy.addToStudyInFather( boxes[1], midFace1, "middle Face")
31 # Mesh one of boxes with quadrangles. It is a source mesh
33 srcMesh = smesh.Mesh(boxes[0], "source mesh") # box coloser to CS origin
34 nSeg1 = srcMesh.Segment().NumberOfSegments(4)
37 srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", SMESH.FACE )
39 # Import faces from midFace0 to the target mesh
41 tgtMesh = smesh.Mesh(boxes[1], "target mesh")
42 importAlgo = tgtMesh.UseExisting2DElements(midFace1)
43 import2hyp = importAlgo.SourceFaces( [srcFaceGroup] )
44 tgtMesh.Segment().NumberOfSegments(3)
48 # Import the whole source mesh with groups
49 import2hyp.SetCopySourceMesh(True,True)