1 # Reorient faces by vector
3 import smesh, geompy, SMESH
5 # create a geometry consisting of two faces
6 box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
7 faces = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])
9 shape = geompy.MakeCompound( faces[:2] )
10 faces = geompy.SubShapeAll( shape, geompy.ShapeType["FACE"] )
11 geompy.addToStudy( shape, "shape")
12 geompy.addToStudyInFather( shape, faces[0], "faces[0]")
13 geompy.addToStudyInFather( shape, faces[1], "faces[1]")
16 mesh = smesh.Mesh( shape, "test_Reorient2D")
17 mesh.AutomaticHexahedralization(0.5)
18 localAlgo = mesh.Segment(faces[0])
19 localAlgo.NumberOfSegments( 11 )
21 group = mesh.Group( faces[1] )
23 vec = geompy.MakeVectorDXDYDZ( 1, 1, 1 )
25 # Each of arguments of Reorient2D() function can be of different types:
27 # 2DObject - the whole mesh
28 # Direction - a GEOM object (vector)
29 # FaceOrPoint - an ID of face
30 mesh.Reorient2D( mesh, vec, mesh.NbElements() )
32 # 2DObject - a sub-mesh
33 # Direction - components of a vector
34 # FaceOrPoint - a GEOM object (vertex)
35 mesh.Reorient2D( localAlgo.GetSubMesh(), [ 1, -1, 1 ], geompy.GetFirstVertex( vec ))
37 # 2DObject - a group of faces
38 # Direction - a SMESH.DirStruct structure
39 # FaceOrPoint - coordinates of a point
40 mesh.Reorient2D( group, smesh.MakeDirStruct( -10, 1, 10 ), [0,0,0])
42 # FaceOrPoint - a SMESH.PointStruct structure
43 mesh.Reorient2D( localAlgo.GetSubMesh().GetIDs(), [10,1,0], SMESH.PointStruct(0,0,0))