From: cconopoima Date: Mon, 16 Oct 2023 12:17:36 +0000 (+0100) Subject: [bos #38088] [CEA] Create documentation for Offset transformation in SMESH. X-Git-Tag: V9_12_0b1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fcce%2F38088;p=modules%2Fsmesh.git [bos #38088] [CEA] Create documentation for Offset transformation in SMESH. Fixing typo critireas is criterias. --- diff --git a/doc/examples/tests.set b/doc/examples/tests.set index 273c4b4ab..883044711 100644 --- a/doc/examples/tests.set +++ b/doc/examples/tests.set @@ -129,6 +129,7 @@ SET(BAD_TESTS transforming_meshes_ex04.py transforming_meshes_ex05.py transforming_meshes_ex06.py + transforming_meshes_ex15.py viewing_meshes_ex01.py radial_prism_3d_algo.py create_dual_mesh.py diff --git a/doc/examples/transforming_meshes_ex15.py b/doc/examples/transforming_meshes_ex15.py new file mode 100644 index 000000000..42dfa641e --- /dev/null +++ b/doc/examples/transforming_meshes_ex15.py @@ -0,0 +1,40 @@ +# Offset 2D mesh, sub-mesh, group or elements from filter. + +import salome +salome.salome_init_without_session() + +import SMESH +from salome.geom import geomBuilder +from salome.smesh import smeshBuilder + +geom_builder = geomBuilder.New() +smesh_builder = smeshBuilder.New() + +box = geom_builder.MakeBoxDXDYDZ(100, 100, 100) + +## ----------- +## +## Offset mesh +## +## ----------- + +init_mesh = smesh_builder.Mesh(box, "box") +init_mesh.AutomaticTetrahedralization() +init_mesh.Compute() + +#Offset triangular elements in mesh (expand the entire mesh) +offset = 20 +mesh, mesh_group = init_mesh.Offset( init_mesh, offset, MakeGroups=False, CopyElements=False ) +assert isinstance( mesh, smeshBuilder.Mesh ) +assert len( mesh_group ) == 0 +offsetMeshArea = smesh_builder.GetArea(mesh) + +#Offset triangular elements in mesh (shrink the entire mesh) +offset = -20 +mesh, mesh_group = init_mesh.Offset( init_mesh, offset, MakeGroups=False, CopyElements=False, NewMeshName="MeshShrink" ) +assert isinstance( mesh, smeshBuilder.Mesh ) +assert len( mesh_group ) == 0 +assert mesh.GetName() == "MeshShrink" +shrinkMeshArea = smesh_builder.GetArea(mesh) + +assert offsetMeshArea > shrinkMeshArea \ No newline at end of file diff --git a/doc/gui/images/image81.png b/doc/gui/images/image81.png new file mode 100644 index 000000000..47e03cc92 Binary files /dev/null and b/doc/gui/images/image81.png differ diff --git a/doc/gui/images/offset_filter_for_faces_gui.png b/doc/gui/images/offset_filter_for_faces_gui.png new file mode 100644 index 000000000..ef39a7bf7 Binary files /dev/null and b/doc/gui/images/offset_filter_for_faces_gui.png differ diff --git a/doc/gui/images/offset_mesh.png b/doc/gui/images/offset_mesh.png new file mode 100644 index 000000000..53aaeed0a Binary files /dev/null and b/doc/gui/images/offset_mesh.png differ diff --git a/doc/gui/images/offset_mesh_from_filter.png b/doc/gui/images/offset_mesh_from_filter.png new file mode 100644 index 000000000..a5d240296 Binary files /dev/null and b/doc/gui/images/offset_mesh_from_filter.png differ diff --git a/doc/gui/input/modifying_meshes.rst b/doc/gui/input/modifying_meshes.rst index 36aeab909..6e574f85a 100644 --- a/doc/gui/input/modifying_meshes.rst +++ b/doc/gui/input/modifying_meshes.rst @@ -15,6 +15,7 @@ Salome provides a vast specter of mesh modification and transformation operation * :ref:`Translate ` in the indicated direction the mesh or some of its elements. * :ref:`Rotate ` by the indicated axis and angle the mesh or some of its elements. * :ref:`Scale ` the mesh or some of its elements. +* :ref:`Offset ` the entire mesh, the sub-mesh or a selection of elements based on filters. * :ref:`Mirror ` the mesh through a point, a vector or a plane of symmetry. * :ref:`double_nodes_page`. Duplication of nodes can be useful to emulate a crack in the model. * :ref:`Merge Nodes` coincident within the indicated tolerance. @@ -58,6 +59,7 @@ Salome provides a vast specter of mesh modification and transformation operation translation.rst rotation.rst scale.rst + offset_elements.rst symmetry.rst double_nodes_page.rst sewing_meshes.rst diff --git a/doc/gui/input/offset_elements.rst b/doc/gui/input/offset_elements.rst new file mode 100644 index 000000000..daa343ce0 --- /dev/null +++ b/doc/gui/input/offset_elements.rst @@ -0,0 +1,49 @@ +.. _offset_elements_page: + +******************************** +Offset mesh +******************************** + +Offset 2D elements in mesh, submesh, group or elements from filter. + +*To offset all elements from mesh, sub-mesh or group:* + +.. |img| image:: ../images/image81.png + +#. In the **Modification** menu, select the **Transformations** then click *Offset* button |img| or click directly in the same button in the toolbar. + + The following dialog box will appear: + + .. image:: ../images/offset_mesh.png + :align: center + + * Check the option **Select whole mesh, sub-mesh or group** if it is not set. + * Set the name of the mesh, sub-mesh or created group. + * Set the **Offset** value (negative offsets are allowed). + * Select **Move Elements** to offset the current mesh, **Copy Elements** to offset and duplicate them, or **Create a new mesh** to create a new mesh from the offset elements. + +#. Click the **Apply** or **Apply and Close** button to confirm the operation. + + +*To offset all elements ids from a filter:* + +#. In the **Modification** menu, select the **Transformations** then click *Offset* button |img| or click directly in the same button from the toolbar. + + * Uncheck the option **Select whole mesh, sub-mesh or group**. + + .. image:: ../images/offset_mesh_from_filter.png + :align: center + + * Then click on **Set_Filter** button + + The dialog for filter for faces will appear: + + .. image:: ../images/offset_filter_for_faces_gui.png + :align: center + + * Define the desired criterias and then click the **Apply and Close** button to confirm the selection of elements. + * Set **Offset** value and mesh creation **options** as done for the first case. + +#. Click the **Apply** or **Apply and Close** button to confirm the operation. + +**See also:** A sample TUI Script of a :ref:`tui_offset_elements` transformation. \ No newline at end of file diff --git a/doc/gui/input/tui_transforming_meshes.rst b/doc/gui/input/tui_transforming_meshes.rst index 59a068c00..01c89f9db 100644 --- a/doc/gui/input/tui_transforming_meshes.rst +++ b/doc/gui/input/tui_transforming_meshes.rst @@ -145,4 +145,14 @@ Create 2D mesh from 3D elements .. literalinclude:: ../../examples/transforming_meshes_ex14.py :language: python -:download:`Download this script <../../examples/transforming_meshes_ex14.py>` \ No newline at end of file +:download:`Download this script <../../examples/transforming_meshes_ex14.py>` + +.. _tui_offset_elements: + +Offset 2D mesh +======================== + +.. literalinclude:: ../../examples/transforming_meshes_ex15.py + :language: python + +:download:`Download this script <../../examples/transforming_meshes_ex15.py>` \ No newline at end of file diff --git a/src/SMESHGUI/SMESHGUI_OffsetDlg.cxx b/src/SMESHGUI/SMESHGUI_OffsetDlg.cxx index 7a47f191c..d66824b1b 100644 --- a/src/SMESHGUI/SMESHGUI_OffsetDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_OffsetDlg.cxx @@ -245,7 +245,7 @@ SMESHGUI_OffsetDlg::SMESHGUI_OffsetDlg( SMESHGUI* theModule ) : myMeshOrSubMeshOrGroupFilter = new SMESH_LogicalFilter(aListOfFilters, SMESH_LogicalFilter::LO_OR); - myHelpFileName = "Offset_page.html"; + myHelpFileName = "offset_elements.html"; Init();