Salome HOME
IPAL53011: Order of sub-mesh in meshing process does't work
[modules/smesh.git] / doc / salome / examples / defining_hypotheses_ex11.py
1 # Projection 1D2D
2
3 # Project triangles from one meshed face to another mesh on the same box
4
5 import salome
6 salome.salome_init()
7 import GEOM
8 from salome.geom import geomBuilder
9 geompy = geomBuilder.New(salome.myStudy)
10
11 import SMESH, SALOMEDS
12 from salome.smesh import smeshBuilder
13 smesh =  smeshBuilder.New(salome.myStudy)
14
15 # Prepare geometry
16
17 # Create a box
18 box = geompy.MakeBoxDXDYDZ(100, 100, 100)
19
20 # Get geom faces to mesh with triangles in the 1ts and 2nd meshes
21 faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
22 # 2 adjacent faces of the box
23 Face_1 = faces[2]
24 Face_2 = faces[0]
25
26 geompy.addToStudy( box, 'box' )
27 geompy.addToStudyInFather( box, Face_1, 'Face_1' )
28 geompy.addToStudyInFather( box, Face_2, 'Face_2' )
29
30
31 # Make the source mesh triangulated by MEFISTO
32 src_mesh = smesh.Mesh(Face_1, "Source mesh")
33 src_mesh.Segment().NumberOfSegments(15)
34 src_mesh.Triangle()
35 src_mesh.Compute()
36
37 # Mesh the target mesh using the algoritm Projection1D2D
38 tgt_mesh = smesh.Mesh(Face_2, "Target mesh")
39 tgt_mesh.Projection1D2D().SourceFace(Face_1,src_mesh)
40 tgt_mesh.Compute()