Salome HOME
bos #26452 [EDF] (2021) SMESH: orientation of faces
[modules/smesh.git] / doc / salome / examples / transforming_meshes_ex13.py
index 37a3f5eed20b01b3dbb18da1b46a60dc3fc56a83..d4b553963d57a3d56c5a04f085b6b54a315a3cf7 100644 (file)
@@ -2,14 +2,14 @@
 
 
 import salome
-salome.salome_init()
+salome.salome_init_without_session()
 import GEOM
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 import SMESH, SALOMEDS
 from salome.smesh import smeshBuilder
-smesh =  smeshBuilder.New(salome.myStudy)
+smesh =  smeshBuilder.New()
 import salome_notebook
 
 
@@ -33,6 +33,10 @@ group = mesh.Group( faces[1] )
 
 vec = geompy.MakeVectorDXDYDZ( 1, 1, 1 )
 
+# ============
+# Reorient2D()
+# ============
+
 # Each of arguments of Reorient2D() function can be of different types:
 #
 # 2DObject    - the whole mesh
@@ -53,6 +57,19 @@ mesh.Reorient2D( group, smesh.MakeDirStruct( -10, 1, 10 ), [0,0,0])
 # FaceOrPoint - a SMESH.PointStruct structure
 mesh.Reorient2D( localAlgo.GetSubMesh().GetIDs(), [10,1,0], SMESH.PointStruct(0,0,0))
 
+# ========================
+# Reorient2DByNeighbours()
+# ========================
+
+# Use faces of 'group' as a reference to reorient equally all faces
+mesh.Reorient2DByNeighbours([mesh], [group])
+
+# Orient equally face on 'group', but not define which orientation is correct
+mesh.Reorient2DByNeighbours([group])
+
+# =================
+# Reorient2DBy3D()
+# =================
 
 # Use Reorient2DBy3D() to orient faces of 2 geom faces to have their normal pointing inside volumes
 
@@ -63,9 +80,9 @@ group1 = mesh3D.Group( faces[1] )
 
 # pass group0 and ids of faces of group1 to inverse
 nbRev = mesh3D.Reorient2DBy3D([ group0, group1.GetIDs() ], mesh3D, theOutsideNormal=False)
-print "Nb reoriented faces:", nbRev
+print("Nb reoriented faces:", nbRev)
 
 # orient the reversed faces back
 nbRev = mesh3D.Reorient2DBy3D( mesh3D, mesh3D, theOutsideNormal=True)
-print "Nb re-reoriented faces:", nbRev
+print("Nb re-reoriented faces:", nbRev)