From: eap Date: Fri, 29 Jun 2012 13:58:07 +0000 (+0000) Subject: 0021542: EDF 1699 SMESH: Reorient a group of faces X-Git-Tag: V6_6_0a1~282 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c210844f50ba69334f8cdeb10737cff30bfb2927;p=modules%2Fsmesh.git 0021542: EDF 1699 SMESH: Reorient a group of faces --- 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 index 000000000..b143ac4eb 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 index 000000000..844ac09ef 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 index 000000000..23c241fcf Binary files /dev/null and b/doc/salome/gui/SMESH/images/reorient_faces_face.png differ diff --git a/doc/salome/gui/SMESH/input/changing_orientation_of_elements.doc b/doc/salome/gui/SMESH/input/changing_orientation_of_elements.doc index 410245b04..416f9514c 100644 --- a/doc/salome/gui/SMESH/input/changing_orientation_of_elements.doc +++ b/doc/salome/gui/SMESH/input/changing_orientation_of_elements.doc @@ -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. To change orientation of elements:
    @@ -11,13 +10,16 @@ nodes of the selected elements.
  1. In the \b Modification menu select the \b Orientation item or click Orientation button in the toolbar. +
    \image html image79.png -
    "Orientation" button
    +"Orientation" button +
    The following dialog box will appear: +
    \image html orientaation1.png - +
    • The main list shall contain the elements which will be reoriented. You can click on an element in the 3D viewer and it will diff --git a/doc/salome/gui/SMESH/input/modifying_meshes.doc b/doc/salome/gui/SMESH/input/modifying_meshes.doc index 024937f9b..36c4e0abb 100644 --- a/doc/salome/gui/SMESH/input/modifying_meshes.doc +++ b/doc/salome/gui/SMESH/input/modifying_meshes.doc @@ -36,6 +36,7 @@ with consequent transformation of all adjacent elements and edges.
    • \subpage uniting_set_of_triangles_page "Unite several adjacent triangles".
    • \subpage changing_orientation_of_elements_page "Change orientation" of the selected elements.
    • +
    • \subpage reorient_faces_page "Reorient faces by vector".
    • \subpage cutting_quadrangles_page "Cut a quadrangle" into two triangles.
    • \subpage split_to_tetra_page "Split" volumic elements into tetrahedra.
    • \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 index 000000000..f637aecfd --- /dev/null +++ b/doc/salome/gui/SMESH/input/reorient_faces.doc @@ -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. + +To change orientation of faces: +
        +
      1. In the \b Modification menu select the Reorient faces by + vector item or click Reorient faces by + vector button in the toolbar. + +
        +\image html reorient_faces_face.png +"Reorient faces by vector" button +
        + +The following dialog box will appear: + +
        +\image html reorient_2d_point.png +\image html reorient_2d_face.png +
        + +
      2. In this dialog +
          +
        • Specify a way of selection of the control face: by point or + explicitely.
        • +
        • Select an \b Object containing faces to reorient, either in the Object + Browser or in the 3D Viewer; it can be either
            +
          • group of faces,
          • +
          • sub-mesh of faces or
          • +
          • mesh.
          • +
        • +
        • 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.
        • +
        • 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.
        • +
        +
      3. + +
      4. Click the \b Apply or Apply and Close button to confirm the operation.
      5. +
      + +
      See Also a sample TUI Script of a +\ref tui_reorient_faces "Reorient faces by vector" operation. + +*/ diff --git a/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc b/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc index 2f2f10d4c..a4c6df87d 100644 --- a/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_transforming_meshes.doc @@ -533,4 +533,54 @@ nb, new_mesh, new_group = init_mesh.MakeBoundaryElements(dim, groupName, meshNam groups=groups, toCopyAll=True) \endcode + +
      +\anchor tui_reorient_faces +

      Reorient faces by vector

      + +\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 + */ diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index da3499e03..0709adca9 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -399,6 +399,18 @@ ICON_DLG_SCALE_ALONG_AXES scale_along_axes.png + + ICON_DLG_REORIENT2D_POINT + reorient_faces_point.png + + + ICON_DLG_REORIENT2D_FACE + reorient_faces_face.png + + + ICON_REORIENT_2D + reorient_faces_face.png + ICON_SMESH_DUPLICATE_NODES mesh_duplicate_nodes.png diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 0cb430a40..9210ae9ac 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -407,6 +407,18 @@ MEN_FIND_ELEM Find Element by Point + + TOP_REORIENT_2D + Reorient faces by vector + + + MEN_REORIENT_2D + Reorient faces by vector + + + STB_REORIENT_2D + Reorient faces by vector + TOP_FIND_ELEM Find Element by Point @@ -6668,4 +6680,62 @@ as they are of improper type: Pre-selection color + + SMESHGUI_ReorientFacesDlg + + CAPTION + Reorient faces by vector + + + REORIENT_FACES + Reorient + + + DIRECTION + Direction + + + OBJECT + Object + + + POINT + Point + + + FACE + Face + + + FACES + Faces + + + ORIENTATION + Orientation + + + + SMESHGUI_ReorientFacesOp + + NO_OBJECT_SELECTED + No object selected + + + NO_FACES + Object includes no faces + + + ZERO_SIZE_VECTOR + Zero size vector + + + INVALID_FACE + Not valid face + + + NB_REORIENTED + %1 faces reversed + +