Salome HOME
PR: synchro V6_main tag mergeto_V7_main_11Feb13
[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 from smesh import *
6
7 # Prepare geometry
8
9 # Create a box
10 box = geompy.MakeBoxDXDYDZ(100, 100, 100)
11
12 # Get geom faces to mesh with triangles in the 1ts and 2nd meshes
13 faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
14 # 2 adjacent faces of the box
15 Face_1 = faces[2]
16 Face_2 = faces[0]
17
18 geompy.addToStudy( box, 'box' )
19 geompy.addToStudyInFather( box, Face_1, 'Face_1' )
20 geompy.addToStudyInFather( box, Face_2, 'Face_2' )
21
22 # Make the source mesh with Netgem2D
23 src_mesh = Mesh(Face_1, "Source mesh")
24 src_mesh.Segment().NumberOfSegments(15)
25 src_mesh.Triangle()
26 src_mesh.Compute()
27
28 # Mesh the target mesh using the algoritm Projection1D2D
29 tgt_mesh = smesh.Mesh(Face_2, "Target mesh")
30 tgt_mesh.Projection1D2D().SourceFace(Face_1,src_mesh)
31 tgt_mesh.Compute()