Salome HOME
Provide missing TUI examples of some algorithms
authoreap <eap@opencascade.com>
Mon, 20 Aug 2018 15:00:59 +0000 (18:00 +0300)
committereap <eap@opencascade.com>
Mon, 20 Aug 2018 15:00:59 +0000 (18:00 +0300)
15 files changed:
doc/salome/examples/cartesian_algo.py
doc/salome/examples/defining_hypotheses_len_near_vertex.py [new file with mode: 0644]
doc/salome/examples/quad_medial_axis_algo.py [new file with mode: 0644]
doc/salome/examples/tests.set
doc/salome/gui/SMESH/input/constructing_meshes.rst
doc/salome/gui/SMESH/input/quad_from_ma_algo.rst
doc/salome/gui/SMESH/input/segments_around_vertex_algo.rst
doc/salome/gui/SMESH/input/smeshpy_interface.rst
doc/salome/gui/SMESH/input/tui_cartesian_algo.rst [deleted file]
doc/salome/gui/SMESH/input/tui_defining_hypotheses.rst
doc/salome/gui/SMESH/input/tui_generate_flat_elements.rst [deleted file]
doc/salome/gui/SMESH/input/tui_modifying_meshes.rst
doc/salome/gui/SMESH/input/tui_prism_3d_algo.rst [deleted file]
doc/salome/gui/SMESH/input/tui_use_existing_faces.rst [deleted file]
src/SMESH_SWIG/smeshBuilder.py

index e9d7748c7319a8ce0b0f620b753492ac0b1d6038..26bdb8bf0eaaad9c22bb0051e1561cb89f1c7c10 100644 (file)
@@ -10,7 +10,6 @@ geompy = geomBuilder.New()
 import SMESH, SALOMEDS
 from salome.smesh import smeshBuilder
 smesh =  smeshBuilder.New()
-import salome_notebook
 
 
 # create a sphere
diff --git a/doc/salome/examples/defining_hypotheses_len_near_vertex.py b/doc/salome/examples/defining_hypotheses_len_near_vertex.py
new file mode 100644 (file)
index 0000000..6d8ab44
--- /dev/null
@@ -0,0 +1,29 @@
+# Usage of Segments around Vertex algorithm
+
+# for meshing a box with quadrangles with refinement near vertices
+
+import salome
+salome.salome_init()
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+from salome.smesh import smeshBuilder
+smesh =  smeshBuilder.New()
+
+# create a box
+box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
+
+# make a mesh
+mesh = smesh.Mesh( box )
+
+# define quadrangle meshing
+algo1d = mesh.Segment()
+algo1d.LocalLength( 1. )
+mesh.Quadrangle()
+
+# add Hexahedron algo to assure that there are no triangles
+mesh.Hexahedron()
+
+# define refinement near vertices
+algo1d.LengthNearVertex( 0.2 )
+
+mesh.Compute()
diff --git a/doc/salome/examples/quad_medial_axis_algo.py b/doc/salome/examples/quad_medial_axis_algo.py
new file mode 100644 (file)
index 0000000..42aea88
--- /dev/null
@@ -0,0 +1,30 @@
+# Usage of Medial Axis Projection algorithm
+
+# for meshing a ring face with quadrangles
+
+import salome
+salome.salome_init()
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+from salome.smesh import smeshBuilder
+smesh =  smeshBuilder.New()
+
+# create a ring face
+circleEdge1 = geompy.MakeCircleR( 3 )
+circleEdge2 = geompy.MakeCircleR( 7 )
+ring = geompy.MakeFaceWires( [ circleEdge1, circleEdge2 ], True, theName='Ring' )
+circleLen1  = geompy.BasicProperties( circleEdge1 )[0]
+circleLen2  = geompy.BasicProperties( circleEdge2 )[0]
+
+# make a mesh
+
+mesh = smesh.Mesh( ring )
+
+circNbSeg = 60
+algo1d = mesh.Segment()
+algo1d.NumberOfSegments( circNbSeg ) # division of circle edges
+
+algo2d = mesh.Quadrangle( smeshBuilder.QUAD_MA_PROJ )
+algo2d.StartEndLength( circleLen2 / circNbSeg, circleLen1 / circNbSeg ) # radial division
+
+mesh.Compute()
index 1a2dd81059f2611bb5707cff36669aa80dd6928f..f5fddb58218c8c179adac2416920ced58c66097f 100644 (file)
@@ -175,6 +175,8 @@ SET(GOOD_TESTS
   use_existing_faces.py
   viewing_meshes_ex02.py
   split_biquad.py
+  quad_medial_axis_algo.py
+  defining_hypotheses_len_near_vertex.py
 )
 
 SET(EXAMPLES_TESTS ${BAD_TESTS} ${GOOD_TESTS} testme.py)
index bb269953a8f03f9f6898945f73b6b26fd8a1cfc8..d26102f43049ac47f650011b1a9ad51a4ed9c41d 100644 (file)
@@ -136,7 +136,7 @@ To construct a mesh:
    * **Applied algorithms** folder containing the references to the algorithms chosen at the construction of the mesh. 
    * **SubMeshes on Face** folder containing the sub-meshes defined on geometrical faces. There also can be folders for sub-meshes on vertices, edges, wires, shells, solids and compounds.
    * **Groups of Faces** folder containing the groups of mesh faces. There also can be folders for groups of nodes, edges, volumes 0D elements and balls.
-    
+
 
    There is an alternative way to assign Algorithms and Hypotheses by clicking **Assign a set of hypotheses** button and selecting among pre-defined sets of algorithms and hypotheses. In addition to the built-in sets of hypotheses, it is possible to create custom sets by editing CustomMeshers.xml file located in the home directory. CustomMeshers.xml file must describe sets of hypotheses in the same way as ${SMESH_ROOT_DIR}/share/salome/resources/smesh/StdMeshers.xml file does (sets of hypotheses are enclosed between \<hypotheses-set-group\> tags). For example:
        ::
index 92413e4963472bc3b986266b3af03174e93a04ab..b9b7cd482eae384846aa0afab3c7eca5ccf42cb1 100644 (file)
@@ -40,3 +40,7 @@ The Medial Axis is used in two ways:
 
 .. centered::
        Mesh depends on defined sub-meshes: to the left - sub-meshes on both wires, to the right - a sub-mesh on internal wire only
+
+
+**See Also** a sample TUI Script of a :ref:`tui_quad_ma_proj_algo`.
+
index 811ba02541291e81f58a8940fa5204de2943fc74..e70c160a6c75fce4b3f336dbe12adc51d3f10854 100644 (file)
@@ -10,6 +10,8 @@ the local size of the segments in the neighborhood of a certain
 vertex. If we assign this algorithm to a geometrical object of higher
 dimension, it applies to all its vertices.
 
+.. _note: To create 0D elements, use :ref:`adding_nodes_and_elements_page` operation.
+
 Length of segments near vertex is defined by **Length Near Vertex** hypothesis.
 This hypothesis is used by :ref:`Wire Discretization <a1d_algos_anchor>` or
 :ref:`Composite Side Discretization <a1d_algos_anchor>` algorithms as
@@ -20,5 +22,4 @@ segment length required by **Length Near Vertex** hypothesis.
 .. image:: ../images/lengthnearvertex.png
        :align: center                                                 
 
-
-
+**See also** a sample :ref:`TUI Script <tui_segments_around_vertex>`.
index 0e209705a2372cd2c69bd735b36158a8ff8546ec..ce80d7411d90c8e4871ad583682fedb4d592c9f5 100644 (file)
@@ -104,10 +104,6 @@ the following links:
    tui_measurements
    tui_work_on_objects_from_gui
    tui_notebook_smesh
-   tui_cartesian_algo
-   tui_use_existing_faces
-   tui_prism_3d_algo
-   tui_generate_flat_elements
 
 .. toctree::
    :hidden:
diff --git a/doc/salome/gui/SMESH/input/tui_cartesian_algo.rst b/doc/salome/gui/SMESH/input/tui_cartesian_algo.rst
deleted file mode 100644 (file)
index 2dd01be..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-.. _tui_cartesian_algo:
-
-Usage of Body Fitting algorithm
-###############################
-
-.. literalinclude:: ../../../examples/cartesian_algo.py
-    :linenos:
-    :language: python
-
-:download:`Download this script <../../../examples/cartesian_algo.py>`
-
-
-
index 0642126baef019c6c8ea4dfcae0cdf1087019a6b..c839e94b9750a478d8284bd934005dbcc9b77301 100644 (file)
@@ -10,7 +10,7 @@ and hypotheses.
 * Wire discretisation 1D algorithm
   
     * :ref:`tui_1d_adaptive` hypothesis
-    * :ref:`rithmetic Progression <tui_1d_arithmetic>` hypothesis
+    * :ref:`Arithmetic Progression <tui_1d_arithmetic>` hypothesis
     * :ref:`Geometric Progression <tui_1d_arithmetic>` hypothesis
     * :ref:`Deflection and Number of Segments <tui_deflection_1d>` hypotheses
     * :ref:`Start and End Length <tui_start_and_end_length>` hypothesis
@@ -24,20 +24,23 @@ and hypotheses.
     * :ref:`tui_max_element_area` hypothesis 
     * :ref:`tui_length_from_edges` hypothesis 
   
+* Quadrangle: Mapping 2D algorithm
+  
+    * :ref:`Quadrangle Parameters <tui_quadrangle_parameters>` hypothesis 
 
+* :ref:`Radial Quadrangle 1D-2D <tui_radial_quadrangle>` algorithm
 * NETGEN 3D algorithm
   
     *  :ref:`tui_max_element_volume` hypothesis 
     *  :ref:`Viscous layers <tui_viscous_layers>` hypotheses
 
 * :ref:`tui_projection`
-* :ref:`Radial Quadrangle 1D-2D <tui_radial_quadrangle>` algorithm
-* Quadrangle: Mapping 2D algorithm
-  
-    * :ref:`Quadrangle Parameters <tui_quadrangle_parameters>` hypothesis 
-
-* :ref:`tui_radial_prism`
+* :ref:`Extrusion 3D <tui_prism_3d_algo>` algorithm
+* :ref:`Radial Prism <tui_radial_prism>` algorithm
+* :ref:`Body Fitting <tui_cartesian_algo>` algorithm
 * :ref:`Import 1D-2D Elements from Another Mesh <tui_import>` algorithm
+* :ref:`Use Faces to be Created Manually <tui_use_existing_faces>` algorithm
+* :ref:`Segments around Vertex <tui_segments_around_vertex>` algorithm
 
 
 
@@ -262,3 +265,76 @@ Radial Prism example
     :language: python
 
 :download:`Download this script <../../../examples/radial_prism_3d_algo.py>`
+
+.. _tui_cartesian_algo:
+
+Usage of Body Fitting algorithm
+###############################
+
+.. literalinclude:: ../../../examples/cartesian_algo.py
+    :linenos:
+    :language: python
+
+:download:`Download this script <../../../examples/cartesian_algo.py>`
+
+.. _tui_use_existing_faces: 
+
+Usage of "Use Faces to be Created Manually" algorithm
+#####################################################
+
+This sample demonstrates how to use **Use Faces to be Created Manually** algorithm,
+which is actually just a stub allowing to use your own 2D algorithm
+implemented in Python.
+
+.. literalinclude:: ../../../examples/use_existing_faces.py
+    :linenos:
+    :language: python
+
+:download:`Download this script <../../../examples/use_existing_faces.py>`
+
+Resulting mesh:
+
+.. image:: ../images/use_existing_face_sample_mesh.png
+       :align: center
+
+
+.. _tui_prism_3d_algo:
+
+Usage of Extrusion 3D meshing algorithm
+########################################
+
+.. literalinclude:: ../../../examples/prism_3d_algo.py
+    :linenos:
+    :language: python
+
+:download:`Download this script <../../../examples/prism_3d_algo.py>`
+
+The result geometry and mesh is shown below
+
+.. image:: ../images/prism_tui_sample.png
+       :align: center
+
+
+.. _tui_quad_ma_proj_algo:
+
+Usage of Medial Axis Projection algorithm
+#########################################
+
+.. literalinclude:: ../../../examples/quad_medial_axis_algo.py
+    :linenos:
+    :language: python
+
+:download:`Download this script <../../../examples/quad_medial_axis_algo.py>`
+
+
+.. _tui_segments_around_vertex:
+
+Usage of Segments around Vertex algorithm
+#########################################
+
+.. literalinclude:: ../../../examples/defining_hypotheses_len_near_vertex.py
+    :linenos:
+    :language: python
+
+:download:`Download this script <../../../examples/defining_hypotheses_len_near_vertex.py>`
+
diff --git a/doc/salome/gui/SMESH/input/tui_generate_flat_elements.rst b/doc/salome/gui/SMESH/input/tui_generate_flat_elements.rst
deleted file mode 100644 (file)
index 6a6790e..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-.. _tui_generate_flat_elements_page: 
-
-**********************
-Generate flat elements
-**********************
-
-
-.. _tui_double_nodes_on_group_boundaries:
-
-Double nodes on groups boundaries
-#################################
-
-Double nodes on shared faces between groups of volumes and create flat elements on demand.
-
-The list of groups must contain at least two groups. The groups have to be disjoint: no common element into two different groups.
-
-The nodes of the internal faces at the boundaries of the groups are doubled. Optionally, the internal faces are replaced by flat elements.
-
-Triangles are transformed into prisms, and quadrangles into hexahedrons.
-
-The flat elements are stored in groups of volumes.
-
-These groups are named according to the position of the group in the list:
-the group j_n_p is the group of the flat elements that are built between the group \#n and the group \#p in the list.
-If there is no shared faces between the group \#n and the group \#p in the list, the group j_n_p is not created.
-All the flat elements are gathered into the group named "joints3D" (or "joints2D" in 2D situation).
-The flat element of the multiple junctions between the simple junction are stored in a group named "jointsMultiples".
-
-This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder).
-The big cylinder is defined by two geometric volumes.
-
-.. literalinclude:: ../../../examples/generate_flat_elements.py
-    :linenos:
-    :language: python
-
-:download:`Download this script <../../../examples/generate_flat_elements.py>`
-
-Here, the 4 groups of volumes [Solid_1_1, Solid_2_1, Solid_3_1, Solid_4_1] constitute a partition of the mesh.
-The flat elements on group boundaries and on faces are built with the
-2 last lines of the code above.
-
-If the last argument (Boolean) in DoubleNodesOnGroupBoundaries is set to 1,
-the flat elements are built, otherwise, there is only a duplication of the nodes.
-
-To observe flat element groups, save the resulting mesh on a MED file and reload it.
-
-
index 25783ad856fc6e0b05ee6cef832a3b360bb1c1c3..e90ba372608a56474e39ece39fe757672fc8b3e6 100644 (file)
@@ -313,3 +313,44 @@ Split bi-quadratic into linear
     :language: python
 
 :download:`Download this script <../../../examples/split_biquad.py>`
+
+.. _tui_double_nodes_on_group_boundaries:
+
+Double nodes on groups boundaries
+=================================
+
+Double nodes on shared faces between groups of volumes and create flat elements on demand.
+
+The list of groups must contain at least two groups. The groups have to be disjoint: no common element into two different groups.
+
+The nodes of the internal faces at the boundaries of the groups are doubled. Optionally, the internal faces are replaced by flat elements.
+
+Triangles are transformed into prisms, and quadrangles into hexahedrons.
+
+The flat elements are stored in groups of volumes.
+
+These groups are named according to the position of the group in the list:
+the group j_n_p is the group of the flat elements that are built between the group \#n and the group \#p in the list.
+If there is no shared faces between the group \#n and the group \#p in the list, the group j_n_p is not created.
+All the flat elements are gathered into the group named "joints3D" (or "joints2D" in 2D situation).
+The flat element of the multiple junctions between the simple junction are stored in a group named "jointsMultiples".
+
+This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder).
+The big cylinder is defined by two geometric volumes.
+
+.. literalinclude:: ../../../examples/generate_flat_elements.py
+    :linenos:
+    :language: python
+
+:download:`Download this script <../../../examples/generate_flat_elements.py>`
+
+Here, the 4 groups of volumes [Solid_1_1, Solid_2_1, Solid_3_1, Solid_4_1] constitute a partition of the mesh.
+The flat elements on group boundaries and on faces are built with the
+2 last lines of the code above.
+
+If the last argument (Boolean) in DoubleNodesOnGroupBoundaries is set to 1,
+the flat elements are built, otherwise, there is only a duplication of the nodes.
+
+To observe flat element groups, save the resulting mesh on a MED file and reload it.
+
+
diff --git a/doc/salome/gui/SMESH/input/tui_prism_3d_algo.rst b/doc/salome/gui/SMESH/input/tui_prism_3d_algo.rst
deleted file mode 100644 (file)
index 6bc69d4..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-.. _tui_prism_3d_algo:
-
-**********************************
-Use Extrusion 3D meshing algorithm
-**********************************
-
-.. literalinclude:: ../../../examples/prism_3d_algo.py
-    :linenos:
-    :language: python
-
-:download:`Download this script <../../../examples/prism_3d_algo.py>`
-
-The result geometry and mesh is shown below
-
-.. image:: ../images/prism_tui_sample.png
-       :align: center
-
-
-
diff --git a/doc/salome/gui/SMESH/input/tui_use_existing_faces.rst b/doc/salome/gui/SMESH/input/tui_use_existing_faces.rst
deleted file mode 100644 (file)
index baaf81a..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-.. _tui_use_existing_faces: 
-
-*****************************************************
-Usage of "Use Faces to be Created Manually" algorithm
-*****************************************************
-
-This sample demonstrates how to use **Use Faces to be Created Manually** algorithm,
-which is actually just a stub allowing to use your own 2D algorithm
-implemented in Python.
-
-.. literalinclude:: ../../../examples/use_existing_faces.py
-    :linenos:
-    :language: python
-
-:download:`Download this script <../../../examples/use_existing_faces.py>`
-
-Resulting mesh:
-
-.. image:: ../images/use_existing_face_sample_mesh.png
-       :align: center
index c21f7f008ba408af21c3b087b52d14db343e6b87..864e695989d930c113b9ea4566d831139a38bc13 100644 (file)
@@ -3679,7 +3679,9 @@ class Mesh(metaclass = MeshMeta):
                 isElem2: *True* if *id2* is element id, *False* if it is node id
 
         Returns:
-            minimum distance value **GetMinDistance()**
+            minimum distance value
+        See Also:
+            :meth:`GetMinDistance`
         """
 
         aMeasure = self.GetMinDistance(id1, id2, isElem1, isElem2)