Salome HOME
[bos #38088] [CEA] Create documentation for Offset transformation in SMESH. cce/38088 22/head
authorcconopoima <cesar.conopoima@gmail.com>
Mon, 16 Oct 2023 12:17:36 +0000 (13:17 +0100)
committercconopoima <cesar.conopoima@gmail.com>
Mon, 23 Oct 2023 15:02:05 +0000 (16:02 +0100)
Fixing typo critireas is criterias.

doc/examples/tests.set
doc/examples/transforming_meshes_ex15.py [new file with mode: 0644]
doc/gui/images/image81.png [new file with mode: 0644]
doc/gui/images/offset_filter_for_faces_gui.png [new file with mode: 0644]
doc/gui/images/offset_mesh.png [new file with mode: 0644]
doc/gui/images/offset_mesh_from_filter.png [new file with mode: 0644]
doc/gui/input/modifying_meshes.rst
doc/gui/input/offset_elements.rst [new file with mode: 0644]
doc/gui/input/tui_transforming_meshes.rst
src/SMESHGUI/SMESHGUI_OffsetDlg.cxx

index 273c4b4ab0b2b8f2a5f4ae3371f27a5aa8976150..883044711ab601f8052f5045b5e2e20c3a845dba 100644 (file)
@@ -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 (file)
index 0000000..42dfa64
--- /dev/null
@@ -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 (file)
index 0000000..47e03cc
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 (file)
index 0000000..ef39a7b
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 (file)
index 0000000..53aaeed
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 (file)
index 0000000..a5d2402
Binary files /dev/null and b/doc/gui/images/offset_mesh_from_filter.png differ
index 36aeab909ab15a3ec76ab8c331cef43932e47ae5..6e574f85a098cddbd9ca7a9547533f6e581d1623 100644 (file)
@@ -15,6 +15,7 @@ Salome provides a vast specter of mesh modification and transformation operation
 * :ref:`Translate <translation_page>` in the indicated direction the mesh or some of its elements.
 * :ref:`Rotate <rotation_page>` by the indicated axis and angle the mesh or some of its elements.
 * :ref:`Scale <scale_page>` the mesh or some of its elements.
+* :ref:`Offset <offset_elements_page>` the entire mesh, the sub-mesh or a selection of elements based on filters.
 * :ref:`Mirror <symmetry_page>` 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<merging_nodes_page>` 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 (file)
index 0000000..daa343c
--- /dev/null
@@ -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
index 59a068c00f391ed93fd19ad08292afe175c4f000..01c89f9db97a4f018ff0e6879047dbf57a7c0159 100644 (file)
@@ -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
index 7a47f191c9165b5dc9fe0c67e597f69b19298d33..d66824b1b1b1cc1f79cdcb43737ccfd1d7ba8527 100644 (file)
@@ -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();