X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fsalome%2Fexamples%2Ftransforming_meshes_ex13.py;h=37a3f5eed20b01b3dbb18da1b46a60dc3fc56a83;hb=9d296302bce45a19ce73bcb52e86884ba38f1199;hp=0126b7108390fa00a24e02b080c1671f7b04718c;hpb=9a54694a0ab1e5cbc558a35c4606ceea4f7af2ef;p=modules%2Fsmesh.git diff --git a/doc/salome/examples/transforming_meshes_ex13.py b/doc/salome/examples/transforming_meshes_ex13.py index 0126b7108..37a3f5eed 100644 --- a/doc/salome/examples/transforming_meshes_ex13.py +++ b/doc/salome/examples/transforming_meshes_ex13.py @@ -1,6 +1,17 @@ -# Reorient faces by vector +# Reorient faces + + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) +import salome_notebook -import smesh, geompy, SMESH # create a geometry consisting of two faces box = geompy.MakeBoxDXDYDZ( 10, 10, 10 ) @@ -41,3 +52,20 @@ 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)) + + +# Use Reorient2DBy3D() to orient faces of 2 geom faces to have their normal pointing inside volumes + +mesh3D = smesh.Mesh( box, '3D mesh') +mesh3D.AutomaticHexahedralization(0.5) +group0 = mesh3D.Group( faces[0] ) +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 + +# orient the reversed faces back +nbRev = mesh3D.Reorient2DBy3D( mesh3D, mesh3D, theOutsideNormal=True) +print "Nb re-reoriented faces:", nbRev +