Salome HOME
0021542: EDF 1699 SMESH: Reorient a group of faces
authoreap <eap@opencascade.com>
Fri, 29 Jun 2012 13:58:07 +0000 (13:58 +0000)
committereap <eap@opencascade.com>
Fri, 29 Jun 2012 13:58:07 +0000 (13:58 +0000)
doc/salome/gui/SMESH/images/reorient_2d_face.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/reorient_2d_point.png [new file with mode: 0644]
doc/salome/gui/SMESH/images/reorient_faces_face.png [new file with mode: 0644]
doc/salome/gui/SMESH/input/changing_orientation_of_elements.doc
doc/salome/gui/SMESH/input/modifying_meshes.doc
doc/salome/gui/SMESH/input/reorient_faces.doc [new file with mode: 0644]
doc/salome/gui/SMESH/input/tui_transforming_meshes.doc
src/SMESHGUI/SMESH_images.ts
src/SMESHGUI/SMESH_msg_en.ts

diff --git a/doc/salome/gui/SMESH/images/reorient_2d_face.png b/doc/salome/gui/SMESH/images/reorient_2d_face.png
new file mode 100644 (file)
index 0000000..b143ac4
Binary files /dev/null and b/doc/salome/gui/SMESH/images/reorient_2d_face.png differ
diff --git a/doc/salome/gui/SMESH/images/reorient_2d_point.png b/doc/salome/gui/SMESH/images/reorient_2d_point.png
new file mode 100644 (file)
index 0000000..844ac09
Binary files /dev/null and b/doc/salome/gui/SMESH/images/reorient_2d_point.png differ
diff --git a/doc/salome/gui/SMESH/images/reorient_faces_face.png b/doc/salome/gui/SMESH/images/reorient_faces_face.png
new file mode 100644 (file)
index 0000000..23c241f
Binary files /dev/null and b/doc/salome/gui/SMESH/images/reorient_faces_face.png differ
index 410245b04f060344b737fa10bd7d1205254ecfa0..416f9514cfdb44175f947b4271a10525a7dfa39e 100644 (file)
@@ -2,8 +2,7 @@
 
 \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>
@@ -11,13 +10,16 @@ nodes of the selected elements.
 <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
index 024937f9b48f6f68eeac96103678a9babf8ea3d7..36c4e0abbae041ef649ee5bea334385cb76eac68 100644 (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 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
diff --git a/doc/salome/gui/SMESH/input/reorient_faces.doc b/doc/salome/gui/SMESH/input/reorient_faces.doc
new file mode 100644 (file)
index 0000000..f637aec
--- /dev/null
@@ -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. 
+
+*/
index 2f2f10d4cdbf6337e80a4e9bc7164c43e71399a9..a4c6df87d60af179feaab31896d06b7ca6d40661 100644 (file)
@@ -533,4 +533,54 @@ nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshNam
                                                          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
+
 */
index da3499e03fb12ccff454b37809120bd32b7db518..0709adca95aebfd7201637ec01663e9650f0804a 100644 (file)
             <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>
index 0cb430a4079a8eba4c028a3a548c387db08bc58b..9210ae9acdf3411943ab8a7422291c0293cc0912 100644 (file)
         <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>
@@ -6668,4 +6680,62 @@ as they are of improper type:
         <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>