\page changing_orientation_of_elements_page Changing orientation of elements
-\n Orientation of an element is changed by reverting the order of
-nodes of the selected elements.
+\n Orientation of an element is changed by reverting the order of its nodes.
<em>To change orientation of elements:</em>
<ol>
<li>In the \b Modification menu select the \b Orientation item or click
<em>Orientation</em> button in the toolbar.
+<center>
\image html image79.png
-<center><em>"Orientation" button</em></center>
+<em>"Orientation" button</em>
+</center>
The following dialog box will appear:
+<center>
\image html orientaation1.png
-
+</center>
<ul>
<li><b>The main list</b> shall contain the elements which will be
reoriented. You can click on an element in the 3D viewer and it will
<li>\subpage uniting_set_of_triangles_page "Unite several adjacent triangles".</li>
<li>\subpage changing_orientation_of_elements_page "Change orientation"
of the selected elements.</li>
+<li>\subpage reorient_faces_page "Reorient faces by vector".</li>
<li>\subpage cutting_quadrangles_page "Cut a quadrangle" into two triangles.</li>
<li>\subpage split_to_tetra_page "Split" volumic elements into tetrahedra.</li>
<li>\subpage smoothing_page "Smooth" elements, reducung distortions in
--- /dev/null
+/*!
+
+\page reorient_faces_page Reorient faces by vector
+
+\n This operation allows changing orientation of a set of neighboring
+faces. The desired orientation is defined by a vector. Since direction
+of face normals in the set can be even opposite, it is necessary to
+specify a control face whose normal will be compared with the vector. This
+face can be specified either explicitly or can be found by closeness to
+a given point.
+
+Orientation of a face is changed by reverting the order of its nodes.
+
+<em>To change orientation of faces:</em>
+<ol>
+<li>In the \b Modification menu select the <b>Reorient faces by
+ vector</b> item or click <em>Reorient faces by
+ vector</em> button in the toolbar.
+
+<center>
+\image html reorient_faces_face.png
+<em>"Reorient faces by vector" button</em>
+</center>
+
+The following dialog box will appear:
+
+<center>
+\image html reorient_2d_point.png
+\image html reorient_2d_face.png
+</center>
+
+<li>In this dialog
+<ul>
+<li>Specify a way of selection of the control face: by point or
+ explicitely.</li>
+<li>Select an \b Object containing faces to reorient, either in the Object
+ Browser or in the 3D Viewer; it can be either <ul>
+ <li>group of faces,</li>
+ <li>sub-mesh of faces or</li>
+ <li>mesh.</li>
+ </ul></li>
+<li>Specify either coordinates of a \b Point by which the control face
+ will be found or the control \b Face it-self. You can easy specify the \b
+ Point by either picking a node in the 3D Viewer or by selecting a vertex
+ in the Object Browser. The \b Face can be either picked by mouse in
+ the 3D Viewer or its ID can be entered by typing.</li>
+<li>Set up a \b Direction to be compared with the normal of the
+ control face. You can either pick a node in the 3D Viewer then a \b Direction
+ from the coordinate system origin to the selected node will be set,
+ or you can pick two nodes (holding Shift button) then a \b Direction
+ from the first to the second node will be set.</li>
+</ul>
+</li>
+
+<li>Click the \b Apply or <b>Apply and Close</b> button to confirm the operation.</li>
+</ol>
+
+<br><b>See Also</b> a sample TUI Script of a
+\ref tui_reorient_faces "Reorient faces by vector" operation.
+
+*/
groups=groups, toCopyAll=True)
\endcode
+
+<br>
+\anchor tui_reorient_faces
+<h3>Reorient faces by vector</h3>
+
+\code
+import smesh, geompy, SMESH
+
+# create a geometry consisting of two faces
+box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
+faces = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])
+
+shape = geompy.MakeCompound( faces[:2] )
+faces = geompy.SubShapeAll( shape, geompy.ShapeType["FACE"] )
+geompy.addToStudy( shape, "shape")
+geompy.addToStudyInFather( shape, faces[0], "faces[0]")
+geompy.addToStudyInFather( shape, faces[1], "faces[1]")
+
+# create a 2D mesh
+mesh = smesh.Mesh( shape, "test_Reorient2D")
+mesh.AutomaticHexahedralization(0.5)
+localAlgo = mesh.Segment(faces[0])
+localAlgo.NumberOfSegments( 11 )
+mesh.Compute()
+group = mesh.Group( faces[1] )
+
+vec = geompy.MakeVectorDXDYDZ( 1, 1, 1 )
+
+# Each of arguments of Reorient2D() function can be of different types:
+#
+# 2DObject - the whole mesh
+# Direction - a GEOM object (vector)
+# FaceOrPoint - an ID of face
+mesh.Reorient2D( mesh, vec, mesh.NbElements() )
+#
+# 2DObject - a sub-mesh
+# Direction - components of a vector
+# FaceOrPoint - a GEOM object (vertex)
+mesh.Reorient2D( localAlgo.GetSubMesh(), [ 1, -1, 1 ], geompy.GetFirstVertex( vec ))
+#
+# 2DObject - a group of faces
+# Direction - a SMESH.DirStruct structure
+# FaceOrPoint - coordinates of a point
+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))
+
+\endcode
+
*/
<source>ICON_DLG_SCALE_ALONG_AXES</source>
<translation>scale_along_axes.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_REORIENT2D_POINT</source>
+ <translation>reorient_faces_point.png</translation>
+ </message>
+ <message>
+ <source>ICON_DLG_REORIENT2D_FACE</source>
+ <translation>reorient_faces_face.png</translation>
+ </message>
+ <message>
+ <source>ICON_REORIENT_2D</source>
+ <translation>reorient_faces_face.png</translation>
+ </message>
<message>
<source>ICON_SMESH_DUPLICATE_NODES</source>
<translation>mesh_duplicate_nodes.png</translation>
<source>MEN_FIND_ELEM</source>
<translation>Find Element by Point</translation>
</message>
+ <message>
+ <source>TOP_REORIENT_2D</source>
+ <translation>Reorient faces by vector</translation>
+ </message>
+ <message>
+ <source>MEN_REORIENT_2D</source>
+ <translation>Reorient faces by vector</translation>
+ </message>
+ <message>
+ <source>STB_REORIENT_2D</source>
+ <translation>Reorient faces by vector</translation>
+ </message>
<message>
<source>TOP_FIND_ELEM</source>
<translation>Find Element by Point</translation>
<translation>Pre-selection color</translation>
</message>
</context>
+<context>
+ <name>SMESHGUI_ReorientFacesDlg</name>
+ <message>
+ <source>CAPTION</source>
+ <translation>Reorient faces by vector</translation>
+ </message>
+ <message>
+ <source>REORIENT_FACES</source>
+ <translation>Reorient</translation>
+ </message>
+ <message>
+ <source>DIRECTION</source>
+ <translation>Direction</translation>
+ </message>
+ <message>
+ <source>OBJECT</source>
+ <translation>Object</translation>
+ </message>
+ <message>
+ <source>POINT</source>
+ <translation>Point</translation>
+ </message>
+ <message>
+ <source>FACE</source>
+ <translation>Face</translation>
+ </message>
+ <message>
+ <source>FACES</source>
+ <translation>Faces</translation>
+ </message>
+ <message>
+ <source>ORIENTATION</source>
+ <translation>Orientation</translation>
+ </message>
+</context>
+<context>
+ <name>SMESHGUI_ReorientFacesOp</name>
+ <message>
+ <source>NO_OBJECT_SELECTED</source>
+ <translation>No object selected</translation>
+ </message>
+ <message>
+ <source>NO_FACES</source>
+ <translation>Object includes no faces</translation>
+ </message>
+ <message>
+ <source>ZERO_SIZE_VECTOR</source>
+ <translation>Zero size vector</translation>
+ </message>
+ <message>
+ <source>INVALID_FACE</source>
+ <translation>Not valid face</translation>
+ </message>
+ <message>
+ <source>NB_REORIENTED</source>
+ <translation>%1 faces reversed</translation>
+ </message>
+</context>
</TS>