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