0021542: EDF 1699 SMESH: Reorient a group of faces

This commit is contained in:
eap 2012-06-29 13:58:07 +00:00
parent 3360cf7521
commit c210844f50
9 changed files with 200 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

View File

@ -2,8 +2,7 @@
\page changing_orientation_of_elements_page Changing orientation of elements \page changing_orientation_of_elements_page Changing orientation of elements
\n Orientation of an element is changed by reverting the order of \n Orientation of an element is changed by reverting the order of its nodes.
nodes of the selected elements.
<em>To change orientation of elements:</em> <em>To change orientation of elements:</em>
<ol> <ol>
@ -11,13 +10,16 @@ nodes of the selected elements.
<li>In the \b Modification menu select the \b Orientation item or click <li>In the \b Modification menu select the \b Orientation item or click
<em>Orientation</em> button in the toolbar. <em>Orientation</em> button in the toolbar.
<center>
\image html image79.png \image html image79.png
<center><em>"Orientation" button</em></center> <em>"Orientation" button</em>
</center>
The following dialog box will appear: The following dialog box will appear:
<center>
\image html orientaation1.png \image html orientaation1.png
</center>
<ul> <ul>
<li><b>The main list</b> shall contain the elements which will be <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 reoriented. You can click on an element in the 3D viewer and it will

View File

@ -36,6 +36,7 @@ with consequent transformation of all adjacent elements and edges.</li>
<li>\subpage uniting_set_of_triangles_page "Unite several adjacent triangles".</li> <li>\subpage uniting_set_of_triangles_page "Unite several adjacent triangles".</li>
<li>\subpage changing_orientation_of_elements_page "Change orientation" <li>\subpage changing_orientation_of_elements_page "Change orientation"
of the selected elements.</li> 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 cutting_quadrangles_page "Cut a quadrangle" into two triangles.</li>
<li>\subpage split_to_tetra_page "Split" volumic elements into tetrahedra.</li> <li>\subpage split_to_tetra_page "Split" volumic elements into tetrahedra.</li>
<li>\subpage smoothing_page "Smooth" elements, reducung distortions in <li>\subpage smoothing_page "Smooth" elements, reducung distortions in

View File

@ -0,0 +1,61 @@
/*!
\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.
*/

View File

@ -533,4 +533,54 @@ nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshNam
groups=groups, toCopyAll=True) groups=groups, toCopyAll=True)
\endcode \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
*/ */

View File

@ -399,6 +399,18 @@
<source>ICON_DLG_SCALE_ALONG_AXES</source> <source>ICON_DLG_SCALE_ALONG_AXES</source>
<translation>scale_along_axes.png</translation> <translation>scale_along_axes.png</translation>
</message> </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> <message>
<source>ICON_SMESH_DUPLICATE_NODES</source> <source>ICON_SMESH_DUPLICATE_NODES</source>
<translation>mesh_duplicate_nodes.png</translation> <translation>mesh_duplicate_nodes.png</translation>

View File

@ -407,6 +407,18 @@
<source>MEN_FIND_ELEM</source> <source>MEN_FIND_ELEM</source>
<translation>Find Element by Point</translation> <translation>Find Element by Point</translation>
</message> </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> <message>
<source>TOP_FIND_ELEM</source> <source>TOP_FIND_ELEM</source>
<translation>Find Element by Point</translation> <translation>Find Element by Point</translation>
@ -6668,4 +6680,62 @@ as they are of improper type:
<translation>Pre-selection color</translation> <translation>Pre-selection color</translation>
</message> </message>
</context> </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> </TS>