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
vec = geompy.MakeVectorDXDYDZ( 1, 1, 1 )
+# ============
+# Reorient2D()
+# ============
+
# Each of arguments of Reorient2D() function can be of different types:
#
# 2DObject - the whole mesh
# 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
# 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)