Merge from V6_6_BR (V6_6_0rc2) 11/12/2012

This commit is contained in:
vsr 2012-12-11 13:23:39 +00:00
parent 0864c4d0a8
commit 13ff1c4641
145 changed files with 4045 additions and 5964 deletions

View File

@ -24,7 +24,7 @@
# Modified by : Alexander BORODIN (OCN) - autotools usage # Modified by : Alexander BORODIN (OCN) - autotools usage
# Created from configure.in.base # Created from configure.in.base
# #
AC_INIT([Salome2 Project SMESH module], [6.5.0], [webmaster.salome@opencascade.com], [SalomeSMESH]) AC_INIT([Salome2 Project SMESH module], [6.6.0], [webmaster.salome@opencascade.com], [SalomeSMESH])
AC_CONFIG_AUX_DIR(adm_local/unix/config_files) AC_CONFIG_AUX_DIR(adm_local/unix/config_files)
AC_CANONICAL_HOST AC_CANONICAL_HOST
AC_CANONICAL_TARGET AC_CANONICAL_TARGET
@ -588,8 +588,7 @@ AC_OUTPUT([ \
src/Tools/padder/resources/appligen/Makefile \ src/Tools/padder/resources/appligen/Makefile \
src/Tools/padder/resources/appligen/appligen.sh \ src/Tools/padder/resources/appligen/appligen.sh \
src/Tools/padder/resources/appligen/config_appli.xml \ src/Tools/padder/resources/appligen/config_appli.xml \
src/Tools/padder/resources/padderexe/Makefile \ src/Tools/padder/resources/testdata/Makefile \
src/Tools/padder/resources/padderexe/envPadder.sh \
src/Tools/padder/unittests/Makefile \ src/Tools/padder/unittests/Makefile \
src/Tools/padder/unittests/autotest.sh \ src/Tools/padder/unittests/autotest.sh \
src/Tools/padder/doc/Makefile \ src/Tools/padder/doc/Makefile \

View File

@ -23,7 +23,7 @@ SET(top_builddir ${CMAKE_BINARY_DIR})
SET(top_srcdir ${CMAKE_SOURCE_DIR}) SET(top_srcdir ${CMAKE_SOURCE_DIR})
SET(srcdir ${CMAKE_CURRENT_SOURCE_DIR}) SET(srcdir ${CMAKE_CURRENT_SOURCE_DIR})
SET(builddir ${CMAKE_CURRENT_BINARY_DIR}) SET(builddir ${CMAKE_CURRENT_BINARY_DIR})
SET(datadir${CMAKE_INSTALL_PREFIX}/share) SET(datadir ${CMAKE_INSTALL_PREFIX}/share)
SET(docdir ${datadir}/doc/salome) SET(docdir ${datadir}/doc/salome)
SET(guidocdir ${docdir}/gui/SMESH) SET(guidocdir ${docdir}/gui/SMESH)
@ -32,7 +32,7 @@ SALOME_CONFIGURE_FILE(doxyfile_py.in doxyfile_py)
SALOME_CONFIGURE_FILE(static/header.html.in ${builddir}/static/header.html) SALOME_CONFIGURE_FILE(static/header.html.in ${builddir}/static/header.html)
SALOME_CONFIGURE_FILE(static/header_py.html.in ${builddir}/static/header_py.html) SALOME_CONFIGURE_FILE(static/header_py.html.in ${builddir}/static/header_py.html)
SALOME_INSTALL_SCRIPTS(collect_mesh_methods.py ${CMAKE_INSTALL_PREFIX}/bin/salome) SALOME_INSTALL_SCRIPTS(collect_mesh_methods.py bin/salome)
SET(DOC_SMESH_MeshersList StdMeshers) SET(DOC_SMESH_MeshersList StdMeshers)
SET(f1 "${srcdir}/collect_mesh_methods.py") SET(f1 "${srcdir}/collect_mesh_methods.py")
@ -71,8 +71,8 @@ ADD_CUSTOM_TARGET(usr_docs ${PYTHON_EXECUTABLE} ${f} smesh.py ${CMAKE_SOURCE_DIR
COMMAND mkdir tmp && ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} && ${PYTHON_EXECUTABLE} ${f1} -o tmp/smesh.py StdMeshers COMMAND mkdir tmp && ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} && ${PYTHON_EXECUTABLE} ${f1} -o tmp/smesh.py StdMeshers
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
COMMAND ${PYTHON_EXECUTABLE} -c "import os, shutil; os.remove(r'''smesh.py'''); os.remove(r'''tmp_env.${EXT}'''); shutil.rmtree(r'''tmp''')" COMMAND ${PYTHON_EXECUTABLE} -c "import os, shutil; os.remove(r'''smesh.py'''); shutil.rmtree(r'''tmp''')"
COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/SMESH''', True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/SMESH''', ignore=shutil.ignore_patterns('*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*')); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/head.png''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/SMESH''')" COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/SMESH''', True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/SMESH''', ignore=shutil.ignore_patterns('tmp_env.*', '*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*')); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/head.png''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/SMESH''')"
VERBATIM VERBATIM
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
) )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -18,11 +18,11 @@ different meshing parameters than the whole mesh.
Several created meshes can be \subpage building_compounds_page "combined into another mesh". Several created meshes can be \subpage building_compounds_page "combined into another mesh".
The whole mesh or it's part can be \subpage copy_mesh_page "copied" into another mesh. The whole mesh or its part can be \subpage copy_mesh_page "copied" into another mesh.
Meshing parameters of meshes and sub-meshes can be Meshing parameters of meshes and sub-meshes can be
\subpage editing_meshes_page "edited", then only a path of mesh \subpage editing_meshes_page "edited", then only the mesh part
depending on changed parameters will be re-computed. depending on the changed parameters will be re-computed.
Meshes can be edited using the MESH functions destined for Meshes can be edited using the MESH functions destined for
\ref modifying_meshes_page "modification" of generated meshes. \ref modifying_meshes_page "modification" of generated meshes.

View File

@ -7,6 +7,7 @@
<ul> <ul>
<li>\ref adding_nodes_anchor "Nodes"</li> <li>\ref adding_nodes_anchor "Nodes"</li>
<li>\ref adding_0delems_anchor "0D Elements"</li> <li>\ref adding_0delems_anchor "0D Elements"</li>
<li>\ref adding_0delems_on_all_nodes_anchor "0D elements on Element Nodes"</li>
<li>\ref adding_balls_anchor "Ball Elements"</li> <li>\ref adding_balls_anchor "Ball Elements"</li>
<li>\ref adding_edges_anchor "Edges"</li> <li>\ref adding_edges_anchor "Edges"</li>
<li>\ref adding_triangles_anchor "Triangles"</li> <li>\ref adding_triangles_anchor "Triangles"</li>
@ -35,7 +36,7 @@ a node or element to the specified group or to create it anew using
<b>Add to group</b> box, that allows choosing an existing group for <b>Add to group</b> box, that allows choosing an existing group for
the created node or element or giving the name to a new group. By the created node or element or giving the name to a new group. By
default, the <b>Add to group</b> check box is switched off. If the user default, the <b>Add to group</b> check box is switched off. If the user
swiches this check box on, the combo box listing all currently switches this check box on, the combo box listing all currently
existing groups of the corresponding type becomes available. By existing groups of the corresponding type becomes available. By
default, no group is selected. In this case, when the user presses default, no group is selected. In this case, when the user presses
<b>Apply</b> or <b>Apply & Close</b> button, the warning message box <b>Apply</b> or <b>Apply & Close</b> button, the warning message box
@ -71,21 +72,50 @@ created:
\image html add0delement.png \image html add0delement.png
In this dialog box specify nodes which will form your 0d elements by In this dialog box specify nodes which will form your 0D elements by
selecting them in the 3D viewer and click the \b Apply or selecting them in the 3D viewer and click the \b Apply or
<b>Apply and Close</b> button. Your 0D elements will be created: <b>Apply and Close</b> button. Your 0D elements will be created:
\image html add_0delement.png \image html add_0delement.png
\anchor adding_0delems_on_all_nodes_anchor
<h2>Making 0D elements on Element Nodes</h2>
There is another way to create 0D elements. It is possible to create
0D elements on all nodes of the selected mesh, sub-mesh, or a group of elements or nodes.
\image html dlg_0D_on_all_nodes.png
In this dialog
<ul>
<li> The radio-buttons allow choosing the type of object to create 0D elements on.
<ul>
<li><b> Mesh, sub-mesh, group </b> - this button allows selecting
a mesh, a sub-mesh or a group to create 0D elements on the nodes of its
elements. The name of the selected object is shown in the dialog. </li>
<li><b> Elements </b> - this button allows selecting elements in the
VTK viewer or typing their IDs in the dialog.</li>
<li><b> Nodes </b> - this button allows selecting nodes to create
0D elements on in the VTK viewer or typing their IDs in the dialog.</li>
</ul></li>
<li><b> Set Filter </b> button allows selecting elements or nodes
by filtering mesh elements or nodes with different criteria
(see \ref filtering_elements "Filter usage").</li>
<li> Switching on <b>Add to group</b> check-box allows specifying the
name of the group to which all created or found 0D elements will be added. You can either select an existing group from
a drop-down list, or enter the name of the group to be created.</li>
</ul>
\anchor adding_balls_anchor \anchor adding_balls_anchor
<h2>Adding ball elements</h2> <h2>Adding ball elements</h2>
\image html addball.png \image html addball.png
In this dialog box specify nodes which will form your ball elements In this dialog box specify the nodes, which will form your ball elements,
either by selecting them in the 3D viewer or by manual entering their IDs, either by selecting them in the 3D viewer or by manually entering their IDs,
specify the ball diameter and click the \b Apply or <b>Apply and specify the ball diameter and click the \b Apply or <b>Apply and
Close</b> button. Your ball elements with an equal diameter will be created: Close</b> button.
\image html add_ball.png \image html add_ball.png

View File

@ -20,8 +20,8 @@ adjacent elements).
<h2>Quadratic Mesh</h2> <h2>Quadratic Mesh</h2>
Quadratic Mesh hypothesis allows to build a quadratic mesh (whose Quadratic Mesh hypothesis allows to build a quadratic mesh (whose
edges are not straight but broken lines and can be defined by three edges are not straight but curved lines and can be defined by three
points: first, middle and last) instead of an ordinary one. points: first, middle and last instead of an ordinary two).
\anchor propagation_anchor \anchor propagation_anchor
<h2>Propagation of 1D Hypothesis on opposite edges</h2> <h2>Propagation of 1D Hypothesis on opposite edges</h2>
@ -47,32 +47,33 @@ hypothesis, this hypothesis has one restriction on its work: the total quantity
segments on all four sides of the face must be even (divisible by 2). segments on all four sides of the face must be even (divisible by 2).
\anchor viscous_layers_anchor \anchor viscous_layers_anchor
<h2>Viscous Layers</h2> <h2>Viscous Layers and Viscous Layers 2D</h2>
<b>Viscous Layers</b> additional hypothesis can be used together with
some 3D algorithms, Hexahedron(i,j,k) for example. This
hypothesis allows creation of layers of highly stretched prisms near
mesh boundary, which is beneficial for high quality viscous
computations. The prisms constructed on the quadrangular mesh faces are
actually the hexahedrons.
<b>Viscous Layers</b> and <b>Viscous Layers 2D </b> additional
hypotheses can be used together with some 3D algorithms, for example,
Hexahedron(i,j,k) or 2D algorithms, for example, Triangle
(MEFISTO), correspondingly. These hypotheses allow creation of layers
of highly stretched elements, prisms in 3D and quadrilaterals in 2D,
near mesh boundary, which is beneficial for high quality viscous
computations.
\image html viscous_layers_hyp.png \image html viscous_layers_hyp.png
<ul> <ul>
<li><b>Name</b> - allows to define the name of the hypothesis.</li> <li><b>Name</b> - allows to define the name of the hypothesis.</li>
<li><b>Total thicknes</b> - gives the total thickness of prism layers.</li> <li><b>Total thickness</b> - gives the total thickness of element layers.</li>
<li><b>Number of layers</b> - defines the number of prism layers.</li> <li><b>Number of layers</b> - defines the number of element layers.</li>
<li><b>Stretch factor</b> - defines the growth factor of prism height <li><b>Stretch factor</b> - defines the growth factor of element height
from the mesh boundary inwards.</li> from the mesh boundary inwards.</li>
<li><b>Faces without layers</b> - defines geometrical faces on which <li><b>Faces (Edges) without layers</b> - defines geometrical faces
prism layers should not be constructed. By default the prism layers (or edges in 2D) on which element layers should not be
are not constructed on geometrical faces shared by solids. constructed. By default the element layers are not constructed on
\note A mesh shown in the 3D Viewer can prevent selection of faces, geometrical faces shared by solids (and edges shared by faces in 2D).
in this case just hide the mesh. To prevent a long waiting when a \note A mesh shown in the 3D Viewer can prevent selection of faces
geometry with many faces is displayed, a number of faces shown at a time and edges, in this case just hide the mesh. To avoid a long wait when a
is limited by the value of "Sub-shapes preview chunk size" preference geometry with many faces (or edges) is displayed, the number of faces
(in Preferences/Mesh/General tab). (edges) shown at a time is limited by the value of "Sub-shapes
preview chunk size" preference (in Preferences/Mesh/General tab).
</li> </li>
</ul> </ul>

View File

@ -64,7 +64,7 @@ There is also a number of more specific algorithms:
</ul> </ul>
\ref use_existing_anchor "Use existing edges" and \ref use_existing_anchor "Use existing edges" and
\ref use_existing_anchor "Use existing faces" algorithms can be \ref use_existing_anchor "Use existing faces" algorithms can be
used to create an 1D or a 2D mesh in a python script. used to create a 1D or a 2D mesh in a python script.
\ref constructing_meshes_page "Constructing meshes" page describes in \ref constructing_meshes_page "Constructing meshes" page describes in
detail how to apply meshing algorithms. detail how to apply meshing algorithms.

View File

@ -14,7 +14,7 @@ shown.
- \b Nodes: - \b Nodes:
- \b Color - color of nodes. - \b Color - color of nodes.
- \b Type and \b Scale - these options allow changing of the nodes - \b Type and \b Scale - these options allow changing the nodes
representation (see \subpage point_marker_page "Point Marker" page representation (see \subpage point_marker_page "Point Marker" page
for more details). for more details).
- <b>Edges / wireframe</b>: - <b>Edges / wireframe</b>:
@ -23,13 +23,13 @@ shown.
in wireframe mode). in wireframe mode).
- \b Faces: - \b Faces:
- \b Front - surface color of face elements (seen in shading mode). - \b Front - surface color of face elements (seen in shading mode).
- \b Back - backside surface color of face elements. Use slider to - \b Back - backside surface color of face elements. Use the slider to
select this color generated on base of the \b Face color by select this color generated on the base of the \b Face color by
changing its brightness and saturation. changing its brightness and saturation.
- \b Volumes: - \b Volumes:
- \b Normal - surface color of normal volume elements (seen in shading mode). - \b Normal - surface color of normal volume elements (seen in shading mode).
- \b Reversed - surface color of volume elements. Use slider to - \b Reversed - surface color of volume elements. Use the slider to
select this color generated on base of the \b Normal color by select this color generated on the base of the \b Normal color by
changing its brightness and saturation. changing its brightness and saturation.
- \b Outlines: - \b Outlines:
- \b Color - color of element borders in shading mode. - \b Color - color of element borders in shading mode.

View File

@ -37,42 +37,42 @@ written in Python.
"Create mesh" dialog box contains several tab pages titled \b 3D, "Create mesh" dialog box contains several tab pages titled \b 3D,
\b 2D, \b 1D and \b 0D. The title of each page reflects the \b 2D, \b 1D and \b 0D. The title of each page reflects the
dimension of the CAD model (geometry) the algorithms listed on dimension of the CAD model (geometry) the algorithms listed on
this page affect to. For example, \b 3D page lists algorithms this page affect. For example, \b 3D page lists the algorithms
that affect 3D geometrical objects (solids). that affect 3D geometrical objects (solids).
\note \note
- Some page(s) can be disabled - if the source geometrical - Some page(s) can be disabled if the source geometrical
object does not include shapes (sub-shapes) of the corresponding object does not include shapes (sub-shapes) of the corresponding
dimension(s). For example, if input object is a geometrical face, dimension(s). For example, if the input object is a geometrical face,
\b 3D page is disabled. \b 3D page is disabled.
- Some algorithms affect on geometry of several dimensions, - Some algorithms affect the geometry of several dimensions,
i.e. "1D-2D" or "1D-2D-3D". If such algorithm is selected by the i.e. "1D-2D" or "1D-2D-3D". If such an algorithm is selected by the
user, dialog box pages related to the corresponding lower level user, the dialog box pages related to the corresponding lower level
dimensions are disabled. dimensions are disabled.
- \b 0D page does not refer to the 0D elements, but to 0D - \b 0D page does not refer to the 0D elements, but to 0D
geometry (vertices). Mesh module does not provide algorithms that geometry (vertices). Mesh module does not provide algorithms that
produce 0D elements. Currently \b 0D page provides only one produce 0D elements. Currently \b 0D page provides only one
algorithm "Segments around vertex" that allows specyfing required algorithm "Segments around vertex" that allows specyfying the required
size of mesh edges about some selected vertex(vertices). size of mesh edges about the selected vertex (or vertices).
For example, you need to mesh a 3D object. For example, you need to mesh a 3D object.
First, type the name for your mesh in the \b Name box, by default, First, type the name of your mesh in the \b Name box, by default,
it is "Mesh_1". Then select the geometrical object you wish to it is "Mesh_1". Then select the geometrical object you wish to
mesh in the Object Browser and click "Select" button near \b Geometry mesh in the Object Browser and click "Select" button near \b Geometry
field (if name of the object not yet appeared in \b Geometry field). field (if the name of the object has not yet appeared in \b Geometry field).
\image html image120.png \image html image120.png
<em>"Select" button</em> <em>"Select" button</em>
Now you can define 3D Algorithm and 3D Hypotheses, which will be Now you can define 3D Algorithm and 3D Hypotheses, which will be
applied to solids of your geometrical object. Click the <em>"Add applied to the solids of your geometrical object. Click the <em>"Add
Hypothesis"</em> button to add a hypothesis. Hypothesis"</em> button to add a hypothesis.
\image html image121.png \image html image121.png
<em>"Add Hypothesis" button</em> <em>"Add Hypothesis" button</em>
Click the <em>"Edit Hypothesis"</em> button to change values for the Click the <em>"Edit Hypothesis"</em> button to change the values for the
current hypothesis. current hypothesis.
\image html image122.png \image html image122.png
@ -86,14 +86,14 @@ written in Python.
will be used to mesh faces and edges of your geometry. (Note will be used to mesh faces and edges of your geometry. (Note
that any object has edges, even if their existence is not that any object has edges, even if their existence is not
apparent, for example, a sphere has 4 edges). Note that the apparent, for example, a sphere has 4 edges). Note that the
choice of hypotheses and of an algorithm of lower dimension depends on choice of hypotheses and lower dimension algorithms depends on
the algorithm. the higher dimension algorithm.
Some algorithms generate mesh of several dimensions while others, of Some algorithms generate mesh of several dimensions, while others
only one dimension. In the latter case there must be one Algorithm and zero or several produce mesh of only one dimension. In the latter case there must be one Algorithm and zero or several
Hypotheses for each dimension of your object, otherwise you will Hypotheses for each dimension of your object, otherwise you will
not get any mesh at all. Of course, if you wish to mesh a face, not get any mesh at all. Of course, if you wish to mesh a face,
which is a 2D object, you don't need to define 3D Algorithm and which is a 2D object, you do not need to define a 3D Algorithm and
Hypotheses. Hypotheses.
In the <b>Object Browser</b> the structure of the new mesh will be In the <b>Object Browser</b> the structure of the new mesh will be
@ -122,7 +122,7 @@ written in Python.
tags). tags).
\image html hypo_sets.png \image html hypo_sets.png
List of sets of hypotheses: <em>[custom]</em> List of sets of hypotheses. Tag <em>[custom]</em> is
automatically added to the sets defined by the user automatically added to the sets defined by the user
</li> </li>
</ol> </ol>
@ -164,7 +164,7 @@ Select <b>1D mesh</b> or <b>2D mesh</b> preview mode in the Preview dialog.
<b>Compute</b> button computes the whole mesh. <b>Compute</b> button computes the whole mesh.
When the Preview dialog is closed, the question about the storage of temporarily When the Preview dialog is closed, the question about the storage of temporarily
created mesh elements appers: created mesh elements appears:
\image html preview_tmp_data.png \image html preview_tmp_data.png
@ -185,7 +185,7 @@ Choose "Change submesh priority" from the Mesh menu or a pop-up
menu. The opened dialog shows a list of submeshes in the order of menu. The opened dialog shows a list of submeshes in the order of
their priority. their priority.
There is an example of submesh order modifications of the Mesh created on a Box There is an example of submesh order modifications taking a Mesh created on a Box
shape. The main Mesh object: shape. The main Mesh object:
<ul> <ul>
<li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=20</li> <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=20</li>
@ -195,22 +195,22 @@ shape. The main Mesh object:
The first submesh object <b>Submesh_1</b> created on <b>Face_1</b> is: The first submesh object <b>Submesh_1</b> created on <b>Face_1</b> is:
<ul> <ul>
<li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=4</li> <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=4</li>
<li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>MaxElementArea</b>=1200</li> <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis <b>MaxElementArea</b>=1200</li>
</ul> </ul>
The second submesh object <b>Submesh_2</b> created on <b>Face_2</b> is: The second submesh object <b>Submesh_2</b> created on <b>Face_2</b> is:
<ul> <ul>
<li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=8</li> <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=8</li>
<li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>MaxElementArea</b>=1200</li> <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis <b>MaxElementArea</b>=1200</li>
</ul> </ul>
And the last submesh object <b>Submesh_3</b> created on <b>Face_3</b> is: And the last submesh object <b>Submesh_3</b> created on <b>Face_3</b> is:
<ul> <ul>
<li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=12</li> <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=12</li>
<li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>MaxElementArea</b>=1200</li> <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis <b>MaxElementArea</b>=1200</li>
</ul> </ul>
The sub-meshes become concurrent if they share sub-shapes that can be The sub-meshes become concurrent if they share sub-shapes that can be
meshed with different algorithms (or different hypothesises). In the meshed with different algorithms (or different hypotheses). In the
example, we have three submeshes with concurrent algorithms, because example, we have three submeshes with concurrent algorithms, because
they have different hypotheses. they have different hypotheses.
@ -289,21 +289,21 @@ visualizing in magenta the geometrical entity that causes it.
"Mesh computation/Show a computation result notification" preference "Mesh computation/Show a computation result notification" preference
to the "Never" value. This option gives the possibility to control mesh to the "Never" value. This option gives the possibility to control mesh
computation reporting. There are the following possibilities: always computation reporting. There are the following possibilities: always
show information box, only if an error occurs or never. show the information box, show only if an error occurs or never.
By default, the information box is always shown after mesh computation operation. By default, the information box is always shown after mesh computation operation.
<b>Publish Sub-shape</b> button publishes the sub-shape, whose meshing <b>Publish Sub-shape</b> button publishes the sub-shape, whose meshing
failed, in GEOM component as a child of the mesh geometry, which has failed, in GEOM component as a child of the mesh geometry, which
allows analyzing the problem geometry and creating a submesh on it in allows analyzing the problem geometry and creating a submesh on it in
order to locally tune hypotheses. order to locally tune the hypotheses.
If a cause of failure is an invalid input mesh and the algorithm has If the failure is caused by an invalid input mesh and the algorithm has
provided information on what mesh entities are bad <b>Show bad Mesh</b> found which mesh entities are bad, <b>Show bad Mesh</b>
button appears in the dialog. Clicked, it shows bad mesh entities in button appears in the dialog. Clicked, it shows the bad mesh entities in
the Viewer in magenta. Sometimes the shown mesh entities are too small the Viewer in magenta. Sometimes the shown mesh entities are too small
or/and hidden by other mesh elements, to see them it can be helpful to or/and hidden by other mesh elements. They can be seen after
switch the mesh to Wireframe visualization mode or to switch off switching the mesh to Wireframe visualization mode or switching off
visualization of faces and volumes (if any). the visualization of faces and volumes (if any).
\image html show_bad_mesh.png \image html show_bad_mesh.png
<em>Too close nodes causing meshing failure are shown in magenta using <b>Show <em>Too close nodes causing meshing failure are shown in magenta using <b>Show
@ -313,22 +313,22 @@ visualization of faces and volumes (if any).
\anchor use_existing_anchor \anchor use_existing_anchor
<h2>"Use existing edges" and "Use existing faces" algorithms</h2> <h2>"Use existing edges" and "Use existing faces" algorithms</h2>
It is possible to create an 1D or a 2D mesh in a python script It is possible to create a 1D or a 2D mesh in a python script
(using <em>AddNode, AddEdge</em> and <em>AddFace</em> commands) and (using <em>AddNode, AddEdge</em> and <em>AddFace</em> commands) and
then use such sub-meshes in the construction of a 2D or a 3D mesh. For then use such sub-meshes in the construction of a 2D or a 3D mesh. For
this, there exist two algorithms: <b>Use existing edges</b> and <b>Use this, there exist two algorithms: <b>Use existing edges</b> and <b>Use
existing faces</b>. Scenario of their usage is following. For existing faces</b>.
example, you want to use standard algorithms to generate 1D and 3D For example, you want to use standard algorithms to generate 1D and 3D
meshes and to create 2D mesh by your python code. Then you meshes and to create 2D mesh by your python code. Then you
<ul> <ul>
<li> create a mesh object, assign an 1D algorithm,</li> <li> create a mesh object, assign a 1D algorithm,</li>
<li> invoke \b Compute command, which computes an 1D mesh,</li> <li> invoke \b Compute command, which computes a 1D mesh,</li>
<li> assign <b>Use existing faces</b> and a 3D algorithm,</li> <li> assign <b>Use existing faces</b> and a 3D algorithm,</li>
<li> run your python code, which creates a 2D mesh,</li> <li> run your python code, which creates a 2D mesh,</li>
<li> invoke \b Compute command, which computes a 3D mesh.</li> <li> invoke \b Compute command, which computes a 3D mesh.</li>
</ul> </ul>
Consider trying a sample script demonstrating usage of Consider trying a sample script demonstrating the usage of
\ref tui_use_existing_faces "Use existing faces" algorithm for \ref tui_use_existing_faces "Use existing faces" algorithm for
construction of a 2D mesh using Python commands. construction of a 2D mesh using Python commands.

View File

@ -18,7 +18,9 @@ while the box is a 3D object. <br>
will be used. This means that an edge shared by two faces each having will be used. This means that an edge shared by two faces each having
its own different sub-mesh, will be meshed using algorithms and its own different sub-mesh, will be meshed using algorithms and
hypotheses of any of the two, chosen randomly. This indeterminacy can hypotheses of any of the two, chosen randomly. This indeterminacy can
be fixed by defining \ref submesh_order_anchor "Sub-mesh priority". be fixed by defining \ref submesh_order_anchor "Sub-mesh priority". The
default sub-meshes priority is such that multi-dimensional algorithms
are processed first.
<br> <br>
\n Construction of a sub-mesh consists of: \n Construction of a sub-mesh consists of:
@ -54,30 +56,32 @@ sub-mesh. You can define algorithms and hypotheses in the same way as
in \ref constructing_meshes_page "Create mesh" menu. in \ref constructing_meshes_page "Create mesh" menu.
\par \par
If the parent mesh is already computed, then you can define If the parent mesh is already computed, then you can define the
\b Geometry by picking mesh elements computed on a sub-shape of interest \b Geometry by picking mesh elements computed on a sub-shape of interest
in the 3D Viewer, i.e. you don't have to extract this sub-shape in the 3D Viewer, i.e. you do not have to extract this sub-shape
previously in Geometry module. To start element selection, press \a in Geometry module beforehand. To start element selection, press \a
Selection button to the right of \b Geometry label. If this button is Selection button to the right of \b Geometry label. If this button is
already down, then click it to release and then click it again. The already down, then click it to release and then click it again. The
following pop-up menu to choose a way of geometry definition will following pop-up menu allowing to choose a way of geometry definition will
appear. appear.
\par \par
\image html choose_geom_selection_way.png \image html choose_geom_selection_way.png
\par \par
There the first item enables selecting the sub-shape in the Object <b>Direct geometry selection</b> enables selecting the sub-shape in the Object
Browser, the second one makes appear the following dialog. Browser.
<b>Find geometry by mesh element selection</b> activates the following dialog.
\par \par
\image html find_geom_by_mesh_elem.png \image html find_geom_by_mesh_elem.png
\par \par
In this dialog, <b> Element Type </b> defines kind of element to pick in the In this dialog, <b> Element Type </b> defines kind of element to pick in the
Viewer. Instead of picking an element in the Viewer, you can type its Viewer.
ID in <b> Element ID</b> field. <b> Geometry name </b> allow you Instead of picking an element in the Viewer, you can type its
define a name of the sub-shape with which it will be published in the Study. ID in <b> Element ID</b> field.
<b> Geometry name </b> field allows defining a name of the sub-shape.
\par \par

View File

@ -15,6 +15,8 @@ viewer.</li>
elements which will form your group:</li> elements which will form your group:</li>
<ul> <ul>
<li><b>Nodes</b></li> <li><b>Nodes</b></li>
<li><b>0D Element</b></li>
<li><b>Ball</b></li>
<li><b>Edges</b></li> <li><b>Edges</b></li>
<li><b>Faces</b></li> <li><b>Faces</b></li>
<li><b>Volumes</b></li> <li><b>Volumes</b></li>

View File

@ -28,7 +28,7 @@ the ID of this quadrangle will be added to the list. To remove a
selected element or elements from the list click \b Remove button. <b>Sort selected element or elements from the list click \b Remove button. <b>Sort
list</b> button allows to sort the list of IDs. \b Filter button allows to list</b> button allows to sort the list of IDs. \b Filter button allows to
apply a definite filter to the selection of quadrangles.</li> apply a definite filter to the selection of quadrangles.</li>
<li><b>Apply to all</b> radio button allows to modify the orientation of all <li><b>Apply to all</b> check box allows to modify the orientation of all
quadrangles of the currently displayed mesh or sub-mesh.</li> quadrangles of the currently displayed mesh or sub-mesh.</li>
<li>\b Preview - provides a preview of cutting in the viewer.</li> <li>\b Preview - provides a preview of cutting in the viewer.</li>
</ul> </ul>
@ -39,8 +39,19 @@ quadrangles of the currently displayed mesh or sub-mesh.</li>
<li><b>Use diagonal 1-3</b> and <b>Use diagonal 2-4</b> allows to <li><b>Use diagonal 1-3</b> and <b>Use diagonal 2-4</b> allows to
specify the opposite corners which will be connected by the cutting specify the opposite corners which will be connected by the cutting
edge.</li> edge.</li>
<li><b>Use numeric factor</b> - allows to chose a quality criterion <li><b>Use numeric functor</b> - allows to choose a quality criterion
optimization of which will be used to select the cutting edge.</li> which will be optimized at the outcome of the operation.
<ul>
<li><b>Minimum diagonal</b> - cuts by the shortest edge.</li>
<li><b>Aspect Ratio</b> - cuts by the edge splitting the quadrangle
into triangles with optimal \ref aspect_ratio_page "Aspect Ratio". The reference value is 1.</li>
<li><b>Minimum Angle</b> - cuts by the edge splitting the quadrangle
into triangles with optimal \ref minimum_angle_page "Minimum Angle". The reference value is 60 degrees.</li>
<li><b>Skew</b> - cuts by the edge splitting the quadrangle
into triangles with optimal \ref skew_page "Skew". The reference value
is 0.0 degrees.</li>
</ul>
</li>
</ul> </ul>
</li> </li>
<li><b>Select from</b> - allows to choose a sub-mesh or an existing <li><b>Select from</b> - allows to choose a sub-mesh or an existing

View File

@ -3,18 +3,27 @@
\page extrusion_page Extrusion \page extrusion_page Extrusion
\n Extrusion is used to build mesh elements of plus one \n Extrusion is used to build mesh elements of plus one
dimension than the input ones. Any line or planar element can be dimension than the input ones. Any node, segment or 2D element can be
extruded. Line elements will extrude into quadrilateral plane elements. extruded. Each type of elements has a corresponding type of extruded elements:
Triangular and Quadrilateral plane elements extrude into Pentahedron <table>
and Hexahedron solids respectively. <tr><td><b>Extruded element</b></td><td><b> Result elements </b></td></tr>
<tr><td>Node </td><td> Segments </td></tr>
<tr><td>Segment </td><td> Quadrilaterals </td></tr>
<tr><td>Triangle </td><td> Pentahedrons </td></tr>
<tr><td>Quadrilateral </td><td> Hexahedrons </td></tr>
<tr><td>Polygon </td><td> Polyhedrons </td></tr>
<tr><td>Hexagonal polygon </td><td> Hexagonal prism </td></tr>
</table>
<em>To use extrusion:</em> <em>To use extrusion:</em>
<ol> <ol>
<li>From the \b Modification menu choose the \b Extrusion item or click <li>From the \b Modification menu choose the \b Extrusion item or click
<em>"Extrusion"</em> button in the toolbar. <em>"Extrusion"</em> button in the toolbar.
<center>
\image html image91.png \image html image91.png
<center><em>"Extrusion" button</em></center> <em>"Extrusion" button</em>
</center>
The following dialog common for line and planar elements will appear: The following dialog common for line and planar elements will appear:
@ -26,32 +35,36 @@ The following dialog common for line and planar elements will appear:
<li>In this dialog: <li>In this dialog:
<ul> <ul>
<li>select the type of elements which will be extruded (0D, 1D or 2D),</li> <li>Select the type of elements which will be extruded (0D, 1D or 2D).</li>
<li>specify the IDs of the elements which will be extruded: <li>Specify the IDs of the elements which will be extruded by one
<ul> following means:
<li><b>Select the whole mesh, submesh or group</b> activating this <ul>
checkbox; or</li> <li><b>Select the whole mesh, submesh or group</b> activating this
<li>choose mesh elements with the mouse in the 3D Viewer. It is checkbox.</li>
possible to select a whole area with a mouse frame; or</li> <li>Choose mesh elements with the mouse in the 3D Viewer. It is
<li>input the element IDs directly in <b>ID Elements</b> field. The selected elements will be highlighted in the possible to select a whole area with a mouse frame.</li>
viewer; or</li> <li>Input the element IDs directly in <b>ID Elements</b>
<li>apply Filters. <b>Set filter</b> button allows to apply a filter to the selection of elements. See more field. The selected elements will be highlighted in the viewer.</li>
about filters in the \ref selection_filter_library_page "Selection filter library" page.</li> <li>Apply Filters. <b>Set filter</b> button allows to apply a
</ul> filter to the selection of elements. See more about filters in
</li> the \ref filtering_elements "Selection filters" page.</li>
<li>If the <b>Extrude to Distance</b> radio button is selected</li> </ul>
<ul> </li>
<li>specify the distance at which the elements will be extruded,</li> <li>If the <b>Extrude to Distance</b> radio button is selected</li>
</ul> <ul>
<li>If the <b>Extrude Along Vector</b> radio button is selected</li> <li>specify the distance at which the elements will be extruded.</li>
<ul> </ul>
<li>specify the coordinates of the vector along which the elements will be extruded, or select the face (the normal to the face will define the vector)</li> <li>If the <b>Extrude Along Vector</b> radio button is selected</li>
<li>specify the distance of extrusion along the vector,</li> <ul>
</ul> <li>specify the coordinates of the vector along which the elements
<li>specify the number of steps;</li> will be extruded, or select the face (the normal to the face will
<li>activate <b>Generate Groups</b> checkbox if it is necessary to copy the groups of define the vector),</li>
elements of the source mesh to the newly created one. </li> <li>specify the distance of extrusion along the vector.</li>
</li> </ul>
<li>Specify the number of steps.</li>
<li>If you activate <b>Generate Groups</b> check-box, the created
elements contained in groups will be included into new groups named
by pattern "<old group name>_extruded". </li>
</ul> </ul>
<li>Click \b Apply or <b> Apply and Close</b> button to confirm the operation.</li> <li>Click \b Apply or <b> Apply and Close</b> button to confirm the operation.</li>

View File

@ -4,7 +4,7 @@
\n In MESH there is a functionality allowing importation/exportation \n In MESH there is a functionality allowing importation/exportation
of meshes from/to \b MED, \b UNV (I-DEAS 10), \b DAT (simple ascii format), \b STL, of meshes from/to \b MED, \b UNV (I-DEAS 10), \b DAT (simple ascii format), \b STL,
\b GMF and \b CGNS format files. You can also export a group as a whole mesh. \b GMF (internal format of DISTENE products, namely BLSurf, GHS3D and Hexotic algorithms) and \b CGNS format files. You can also export a group as a whole mesh.
<em>To import a mesh:</em> <em>To import a mesh:</em>

View File

@ -122,9 +122,16 @@ button in the toolbar. You can also right-click on the mesh in the
Object Browser and select Clear Mesh Data in the pop-up menu.</li> Object Browser and select Clear Mesh Data in the pop-up menu.</li>
</ol> </ol>
<center>
\image html mesh_clear.png \image html mesh_clear.png
<center><em>"Clear Mesh Data" button</em></center> <em>"Clear Mesh Data" button</em></center>
\note This command works in a different way in different situations: <ul>
<li> if the mesh is computed on a geometry, then "Clear Mesh Data" removes
all elements and nodes.</li>
<li> if the mesh is not based on a geometry (imported, compound, created from
scratch etc), then "Clear Mesh Data" removes only the elements and
nodes computed by algorithms. If no such elements or nodes have been created, can remove nothing.</li></ul>
<br><b>See Also</b> a sample TUI Script of a <br><b>See Also</b> a sample TUI Script of a
\ref tui_removing_nodes_and_elements "Removing Nodes and Elements" operation. \ref tui_removing_nodes_and_elements "Removing Nodes and Elements" operation.

View File

@ -3,17 +3,17 @@
\page reorient_faces_page Reorient faces by vector \page reorient_faces_page Reorient faces by vector
\n This operation allows changing orientation of a set of neighboring \n This operation allows changing orientation of a set of neighboring
faces. The desired orientation is defined by a vector. Since direction faces. The desired orientation is defined by a vector. Since the direction
of face normals in the set can be even opposite, it is necessary to 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 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 face can be either specified explicitly or found by proximity to
a given point. a given point.
Orientation of a face is changed by reverting the order of its nodes. Orientation of a face is changed by reverting the order of its nodes.
<em>To change orientation of faces:</em> <em>To change orientation of faces:</em>
<ol> <ol>
<li>In the \b Modification menu select the <b>Reorient faces by <li>In the \b Modification menu select <b>Reorient faces by
vector</b> item or click <em>Reorient faces by vector</b> item or click <em>Reorient faces by
vector</em> button in the toolbar. vector</em> button in the toolbar.
@ -31,24 +31,19 @@ The following dialog box will appear:
<li>In this dialog <li>In this dialog
<ul> <ul>
<li>Specify a way of selection of the control face: by point or <li>Specify the way of selection of the control face: by point or
explicitely.</li> explicitly.</li>
<li>Select an \b Object containing faces to reorient, either in the Object <li>Select the \b Object (mesh, sub-mesh or a group of faces) containing faces to reorient in the Object Browser or in the 3D Viewer.</li>
Browser or in the 3D Viewer; it can be either <ul> <li>Specify the coordinates of the \b Point by which the control face
<li>group of faces,</li> will be found or of the control \b Face itself. You can easy specify the \b
<li>sub-mesh of faces or</li> Point by either picking a node in the 3D Viewer or selecting a vertex
<li>mesh.</li> in the Object Browser. It is possible to pick the \b Face by mouse in
</ul></li> the 3D Viewer or enter its ID.</li>
<li>Specify either coordinates of a \b Point by which the control face <li>Set up the \b Direction vector to be compared with the normal of the
will be found or the control \b Face it-self. You can easy specify the \b control face. If you pick a node in the 3D Viewer then the \b Direction
Point by either picking a node in the 3D Viewer or by selecting a vertex vector will go from the coordinate system origin to the selected node.
in the Object Browser. The \b Face can be either picked by mouse in If you pick two nodes (holding Shift button) then the \b Direction vector
the 3D Viewer or its ID can be entered by typing.</li> will go from the first to the second node.</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> </ul>
</li> </li>

View File

@ -15,7 +15,14 @@ load an existing filter library.
the current study. You can \b Add or \b Delete filters. the current study. You can \b Add or \b Delete filters.
\n In <b>Filter name</b> box you can specify the name for your \n In <b>Filter name</b> box you can specify the name for your
filter. By default it is prefixed with the corresponding entity type. filter. By default it is prefixed with the corresponding entity type.
\n Each filter can be applicable to \b Nodes, \b Edges, \b Faces or \b
\anchor filtering_elements
When we use filters during a group creation or another operation (by
clicking <b>Set Filters</b> button in the corresponding dialog), the
menu for setting filters looks a bit differently (see the image below).
Each filter can be applicable to \b Nodes, \b Edges, \b Faces or \b
Volumes. You can combine many criteria in one filter, but they all Volumes. You can combine many criteria in one filter, but they all
must be of the same <b>Entity type</b>. must be of the same <b>Entity type</b>.
\n The \b Add button creates a new criterion at the end of the list of \n The \b Add button creates a new criterion at the end of the list of
@ -30,21 +37,18 @@ sense of a criterion using \b Unary operator Not and you should
specify logical relations between criteria using \b Binary operators specify logical relations between criteria using \b Binary operators
Or and And. Or and And.
\n Some criteria should have the additional parameter of \b Tolerance. \n Some criteria should have the additional parameter of \b Tolerance.
<br>
When we create a group using filters (for this click Switching on <b>Insert filter in viewer</b> checkbox limits
<b>Set Filters</b> button in the <b>Create Group</b> dialog), the menu selection of elements in the Viewer to the current filter.
for setting filters looks a bit differently (see below). Switching
on <b>Insert filter in viewer</b> checkbox limits selection of elements
in the Viewer using your current filter.
<br> <br>
In the \b Source field you choose if the filter will be applied to In the \b Source field you choose if the filter will be applied to
the whole \b Mesh, the <b>Initial Selection</b> or the <b>Current the whole \b Mesh, the <b>Initial Selection</b> or the <b>Current
Group</b>. If \b Mesh is chosen, the elements satisfying the filter Group</b>. If \b Mesh is chosen, the elements satisfying the filter
will be selected in the 3D Viewer. If <b> Initial Selection</b> is will be selected in the 3D Viewer. If <b> Initial Selection</b> is
chosen, the filter will be applied to the selected elements and the chosen, the filter will be applied to the selected elements and the
elements rejected by the filter will be deseleced. If <b>Current elements rejected by the filter will be deselected. If <b>Current
Group</b> is chosen, the filter will be applied to the list of Group</b> is chosen, the filter will be applied to the list of
elements in the <em>Greate Croup</em> dialog and the elements rejected elements in the current dialog and the elements rejected
by the filter will be removed from the list. by the filter will be removed from the list.
<br> <br>
<b>Copy from...</b> button gives you a possibility to load an <b>Copy from...</b> button gives you a possibility to load an
@ -68,7 +72,7 @@ shape the algorithm works slower.
</li><li> </li><li>
<b>Lying on Geom</b> selects entities whose at least one node <b>Lying on Geom</b> selects entities whose at least one node
lies on the shape defined by the <b>Threshold Value</b>. lies on the shape defined by the <b>Threshold Value</b>.
If the hreshold shape is a sub-shape of the main shape of the mesh the If the threshold shape is a sub-shape of the main shape of the mesh the
algorithm works faster, if this is any other algorithm works faster, if this is any other
shape, the algorithm works slower. shape, the algorithm works slower.
</li><li> </li><li>
@ -167,7 +171,7 @@ The following criteria allow selecting mesh <b>Faces</b>:
one element of mesh only. See also a one element of mesh only. See also a
\ref free_edges_page "Free Edges quality control". \ref free_edges_page "Free Edges quality control".
</li><li> </li><li>
<b>Free faces</b> selects 2D mesh elements wich belong to less than two volumes. <b>Free faces</b> selects 2D mesh elements, which belong to less than two volumes.
</li><li> </li><li>
<b>Double faces</b> selects 2D mesh elements basing on the same set of nodes. <b>Double faces</b> selects 2D mesh elements basing on the same set of nodes.
See also \ref filter_double_elements "Double Elements quality control". See also \ref filter_double_elements "Double Elements quality control".

View File

@ -116,6 +116,7 @@ the following links:
- \subpage tui_creating_meshes_page - \subpage tui_creating_meshes_page
- \subpage tui_cartesian_algo - \subpage tui_cartesian_algo
- \subpage tui_use_existing_faces
- \subpage tui_viewing_meshes_page - \subpage tui_viewing_meshes_page
- \subpage tui_defining_hypotheses_page - \subpage tui_defining_hypotheses_page
- \subpage tui_quality_controls_page - \subpage tui_quality_controls_page

View File

@ -11,9 +11,9 @@
<h3>Add Node</h3> <h3>Add Node</h3>
\code \code
import SMESH_mechanic import smesh
mesh = SMESH_mechanic.mesh mesh = smesh.Mesh()
# add node # add node
new_id = mesh.AddNode(50, 10, 0) new_id = mesh.AddNode(50, 10, 0)
@ -27,9 +27,9 @@ else: print "New Node has been added with ID ", new_id
<h3>Add 0D Element</h3> <h3>Add 0D Element</h3>
\code \code
import SMESH_mechanic import smesh
mesh = SMESH_mechanic.mesh mesh = smesh.Mesh()
# add node # add node
node_id = mesh.AddNode(50, 10, 0) node_id = mesh.AddNode(50, 10, 0)
@ -42,6 +42,54 @@ if new_id == 0: print "KO node addition."
else: print "New 0D Element has been added with ID ", new_id else: print "New 0D Element has been added with ID ", new_id
\endcode \endcode
<br>
\anchor tui_add_0DElement_on_all_nodes
<h3>Add 0D Element on Element Nodes</h3>
\code
import smesh, SMESH, geompy
# create a geometry
box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
face = geompy.SubShapeAll( box, geompy.ShapeType["FACE"])[0]
# make 3D mesh
mesh = smesh.Mesh( box )
mesh.AutomaticHexahedralization(0)
# create 0D elements on all nodes of the mesh
res = mesh.Add0DElementsToAllNodes( mesh )
# find 0D elements on all nodes of the mesh, all found nodes are added to a new group
groupName = "0Dmesh"
res = mesh.Add0DElementsToAllNodes( mesh, groupName )
mesh.RemoveGroupWithContents( res ) # remove all found 0D elements
# create 0D elements on all nodes of a sub-mesh, with group creation
groupName = "0Dsubmesh"
submesh = mesh.GetSubMesh( face, "faceSM")
res = mesh.Add0DElementsToAllNodes( submesh, groupName )
# create 0D elements on all nodes of a group
group = mesh.Group( face, "faceGroup" )
res = mesh.Add0DElementsToAllNodes( group )
# remove all 0D elements
mesh.RemoveElements( mesh.GetIdsFromFilter( smesh.GetFilter( SMESH.ELEM0D,
SMESH.FT_ElemGeomType,
"=",SMESH.Geom_POINT )))
# create 0D elements on all nodes of some elements
res = mesh.Add0DElementsToAllNodes( mesh.GetElementsId() )
mesh.RemoveElements( mesh.GetElementsByType( SMESH.ELEM0D ))
# create 0D elements on some nodes
nodes = range(1,10)
res = mesh.Add0DElementsToAllNodes( mesh.GetIDSource( nodes, SMESH.NODE ))
\endcode
<br> <br>
\anchor tui_add_edge \anchor tui_add_edge
<h3>Add Edge</h3> <h3>Add Edge</h3>

View File

@ -1,6 +1,6 @@
/*! /*!
\page tui_use_existing_faces Use existing faces \page tui_use_existing_faces Use existing faces algorithm
This sample demonstrates how to use <b>Use existing faces</b> algorithm, This sample demonstrates how to use <b>Use existing faces</b> algorithm,
which is actulally just a stub allowing to use your own 2D algoritm which is actulally just a stub allowing to use your own 2D algoritm

View File

@ -28,8 +28,8 @@ to sort the list of IDs. The <b>Set filter</b> button allows to apply a
definite filter to selection of triangles.</li> definite filter to selection of triangles.</li>
<li><b>Apply to all</b> radio button allows to modify connectivity and <li><b>Apply to all</b> radio button allows to modify connectivity and
type of all triangles of the currently displayed mesh or sub-mesh.</li> type of all triangles of the currently displayed mesh or sub-mesh.</li>
<li>\b Criterion menu allows to chose a quality criterion <li>\b Criterion menu allows to choose a quality criterion,
optimization of which will be used to select triangles to unite.</li> which will be optimized to select triangles to unite.</li>
<li><b>Select from</b> set of fields allows to choose a sub-mesh or an <li><b>Select from</b> set of fields allows to choose a sub-mesh or an
existing group whose triangle elements will be automatically added to existing group whose triangle elements will be automatically added to
the list.</li> the list.</li>

View File

@ -240,8 +240,11 @@ module SMESH
/*! /*!
* Create Mesh object importing data from given GMF file * Create Mesh object importing data from given GMF file
* \param theFileName - a name of file to import
* \param theMakeRequiredGroups - if true, groups of required entities will be created
*/ */
SMESH_Mesh CreateMeshesFromGMF( in string theFileName, SMESH_Mesh CreateMeshesFromGMF( in string theFileName,
in boolean theMakeRequiredGroups,
out SMESH::ComputeError theError) out SMESH::ComputeError theError)
raises ( SALOME::SALOME_Exception ); raises ( SALOME::SALOME_Exception );

View File

@ -663,7 +663,8 @@ module SMESH
in string file, in string file,
in boolean overwrite ) raises (SALOME::SALOME_Exception); in boolean overwrite ) raises (SALOME::SALOME_Exception);
void ExportGMF( in SMESH_IDSource meshPart, void ExportGMF( in SMESH_IDSource meshPart,
in string file ) raises (SALOME::SALOME_Exception); in string file,
in boolean withRequiredGroups) raises (SALOME::SALOME_Exception);
void ExportPartToDAT( in SMESH_IDSource meshPart, void ExportPartToDAT( in SMESH_IDSource meshPart,
in string file ) raises (SALOME::SALOME_Exception); in string file ) raises (SALOME::SALOME_Exception);
void ExportPartToUNV( in SMESH_IDSource meshPart, void ExportPartToUNV( in SMESH_IDSource meshPart,

View File

@ -151,7 +151,6 @@ module SMESH
*/ */
long AddPolyhedralVolume (in long_array IdsOfNodes, long AddPolyhedralVolume (in long_array IdsOfNodes,
in long_array Quantities); in long_array Quantities);
/*! /*!
* Create volume of many faces, giving IDs of existing faces. * Create volume of many faces, giving IDs of existing faces.
* \param IdsOfFaces List of face IDs for volume creation. * \param IdsOfFaces List of face IDs for volume creation.
@ -160,6 +159,19 @@ module SMESH
*/ */
long AddPolyhedralVolumeByFaces (in long_array IdsOfFaces); long AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
/*!
* Create 0D elements on all nodes of the given object except those
* nodes on which a 0D element already exists.
* \param theObject object on whose nodes 0D elements will be created.
* \param theGroupName optional name of a group to add 0D elements created
* and/or found on nodes of \a theObject.
* \return an object (a new group or a temporary SMESH_IDSource) holding
* ids of new and/or found 0D elements.
*/
SMESH_IDSource Create0DElementsOnAllNodes(in SMESH_IDSource theObject,
in string theGroupName)
raises (SALOME::SALOME_Exception);
/*! /*!
* \brief Bind a node to a vertex * \brief Bind a node to a vertex
* \param NodeID - node ID * \param NodeID - node ID

View File

@ -113,6 +113,8 @@ dist_salomeres_DATA = \
mesh_update.png \ mesh_update.png \
mesh_vertex_n.png \ mesh_vertex_n.png \
mesh_vertex.png \ mesh_vertex.png \
mesh_0D_elem.png \
mesh_0D_on_all_nodes.png \
mesh_volume_3d.png \ mesh_volume_3d.png \
bare_border_volume.png \ bare_border_volume.png \
bare_border_face.png \ bare_border_face.png \

View File

@ -261,6 +261,7 @@
<algo>MEFISTO_2D=Triangle(algo=smesh.MEFISTO)</algo> <algo>MEFISTO_2D=Triangle(algo=smesh.MEFISTO)</algo>
<hypo>LengthFromEdges=LengthFromEdges()</hypo> <hypo>LengthFromEdges=LengthFromEdges()</hypo>
<hypo>MaxElementArea=MaxElementArea(SetMaxElementArea())</hypo> <hypo>MaxElementArea=MaxElementArea(SetMaxElementArea())</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
</python-wrap> </python-wrap>
</algorithm> </algorithm>
@ -275,6 +276,7 @@
<python-wrap> <python-wrap>
<algo>Quadrangle_2D=Quadrangle(algo=smesh.QUADRANGLE)</algo> <algo>Quadrangle_2D=Quadrangle(algo=smesh.QUADRANGLE)</algo>
<hypo>QuadrangleParams=QuadrangleParameters(SetQuadType(),SetTriaVertex())</hypo> <hypo>QuadrangleParams=QuadrangleParameters(SetQuadType(),SetTriaVertex())</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
</python-wrap> </python-wrap>
</algorithm> </algorithm>

BIN
resources/mesh_0D_elem.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

View File

@ -0,0 +1,66 @@
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : DriverGMF.hxx
// Created : Thu Nov 15 16:45:58 2012
// Author : Edward AGAPOV (eap)
#include "DriverGMF.hxx"
#include <boost/filesystem.hpp>
extern "C"
{
#include "libmesh5.h"
}
namespace DriverGMF
{
//================================================================================
/*!
* \brief Closes GMF mesh at destruction
*/
//================================================================================
MeshCloser::~MeshCloser()
{
if ( _gmfMeshID )
GmfCloseMesh( _gmfMeshID );
}
//================================================================================
/*!
* \brief Checks GMF file extension
*/
//================================================================================
bool isExtensionCorrect( const std::string& fileName )
{
std::string ext = boost::filesystem::extension(fileName);
switch ( ext.size() ) {
case 5: return ( ext == ".mesh" || ext == ".solb" );
case 6: return ( ext == ".meshb" );
case 4: return ( ext == ".sol" );
}
return false;
}
}

View File

@ -0,0 +1,46 @@
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : DriverGMF.hxx
// Created : Thu Nov 15 16:45:58 2012
// Author : Edward AGAPOV (eap)
#ifndef __DriverGMF_HXX__
#define __DriverGMF_HXX__
#include <string>
namespace DriverGMF
{
/*!
* \brief An object closing GMF mesh at destruction
*/
struct MeshCloser
{
int _gmfMeshID;
MeshCloser( const int gmfMeshID ): _gmfMeshID(gmfMeshID) {}
~MeshCloser();
};
bool isExtensionCorrect( const std::string& fileName );
}
#endif

View File

@ -24,12 +24,14 @@
// Author : Edward AGAPOV (eap) // Author : Edward AGAPOV (eap)
#include "DriverGMF_Read.hxx" #include "DriverGMF_Read.hxx"
#include "DriverGMF_Write.hxx" #include "DriverGMF.hxx"
#include "SMESHDS_Group.hxx" #include "SMESHDS_Group.hxx"
#include "SMESHDS_Mesh.hxx" #include "SMESHDS_Mesh.hxx"
#include "SMESH_Comment.hxx" #include "SMESH_Comment.hxx"
#include <Basics_Utils.hxx>
extern "C" extern "C"
{ {
#include "libmesh5.h" #include "libmesh5.h"
@ -37,16 +39,10 @@ extern "C"
#include <stdarg.h> #include <stdarg.h>
// --------------------------------------------------------------------------------
// Closing GMF mesh at destruction
DriverGMF_MeshCloser::~DriverGMF_MeshCloser()
{
if ( _gmfMeshID )
GmfCloseMesh( _gmfMeshID );
}
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
DriverGMF_Read::DriverGMF_Read(): DriverGMF_Read::DriverGMF_Read():
Driver_SMESHDS_Mesh() Driver_SMESHDS_Mesh(),
_makeRequiredGroups( true )
{ {
} }
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
@ -62,6 +58,8 @@ DriverGMF_Read::~DriverGMF_Read()
Driver_Mesh::Status DriverGMF_Read::Perform() Driver_Mesh::Status DriverGMF_Read::Perform()
{ {
Kernel_Utils::Localizer loc;
Status status = DRS_OK; Status status = DRS_OK;
int dim, version; int dim, version;
@ -69,9 +67,13 @@ Driver_Mesh::Status DriverGMF_Read::Perform()
// open the file // open the file
int meshID = GmfOpenMesh( myFile.c_str(), GmfRead, &version, &dim ); int meshID = GmfOpenMesh( myFile.c_str(), GmfRead, &version, &dim );
if ( !meshID ) if ( !meshID )
return addMessage( SMESH_Comment("Can't open for reading ") << myFile, /*fatal=*/true ); {
if ( DriverGMF::isExtensionCorrect( myFile ))
DriverGMF_MeshCloser aMeshCloser( meshID ); // An object closing GMF mesh at destruction return addMessage( SMESH_Comment("Can't open for reading ") << myFile, /*fatal=*/true );
else
return addMessage( SMESH_Comment("Not '.mesh' or '.meshb' extension of file ") << myFile, /*fatal=*/true );
}
DriverGMF::MeshCloser aMeshCloser( meshID ); // An object closing GMF mesh at destruction
// Read nodes // Read nodes
@ -277,40 +279,43 @@ Driver_Mesh::Status DriverGMF_Read::Perform()
// Read required entities into groups // Read required entities into groups
// get ids of existing groups if ( _makeRequiredGroups )
std::set< int > groupIDs;
const std::set<SMESHDS_GroupBase*>& groups = myMesh->GetGroups();
std::set<SMESHDS_GroupBase*>::const_iterator grIter = groups.begin();
for ( ; grIter != groups.end(); ++grIter )
groupIDs.insert( (*grIter)->GetID() );
if ( groupIDs.empty() ) groupIDs.insert( 0 );
const int kes[4][3] = { { GmfRequiredVertices, SMDSAbs_Node, nodeIDShift },
{ GmfRequiredEdges, SMDSAbs_Edge, edgeIDShift },
{ GmfRequiredTriangles, SMDSAbs_Face, triaIDShift },
{ GmfRequiredQuadrilaterals,SMDSAbs_Face, quadIDShift }};
const char* names[4] = { "_required_Vertices" ,
"_required_Edges" ,
"_required_Triangles" ,
"_required_Quadrilaterals" };
for ( int i = 0; i < 4; ++i )
{ {
int gmfKwd = kes[i][0]; // get ids of existing groups
SMDSAbs_ElementType entity = (SMDSAbs_ElementType) kes[i][1]; std::set< int > groupIDs;
int shift = kes[i][2]; const std::set<SMESHDS_GroupBase*>& groups = myMesh->GetGroups();
if ( int nb = GmfStatKwd(meshID, gmfKwd)) std::set<SMESHDS_GroupBase*>::const_iterator grIter = groups.begin();
{ for ( ; grIter != groups.end(); ++grIter )
const int newID = *groupIDs.rbegin() + 1; groupIDs.insert( (*grIter)->GetID() );
groupIDs.insert( newID ); if ( groupIDs.empty() ) groupIDs.insert( 0 );
SMESHDS_Group* group = new SMESHDS_Group( newID, myMesh, entity );
group->SetStoreName( names[i] );
myMesh->AddGroup( group );
GmfGotoKwd(meshID, gmfKwd); const int kes[4][3] = { { GmfRequiredVertices, SMDSAbs_Node, nodeIDShift },
for ( int i = 0; i < nb; ++i ) { GmfRequiredEdges, SMDSAbs_Edge, edgeIDShift },
{ GmfRequiredTriangles, SMDSAbs_Face, triaIDShift },
{ GmfRequiredQuadrilaterals,SMDSAbs_Face, quadIDShift }};
const char* names[4] = { "_required_Vertices" ,
"_required_Edges" ,
"_required_Triangles" ,
"_required_Quadrilaterals" };
for ( int i = 0; i < 4; ++i )
{
int gmfKwd = kes[i][0];
SMDSAbs_ElementType entity = (SMDSAbs_ElementType) kes[i][1];
int shift = kes[i][2];
if ( int nb = GmfStatKwd(meshID, gmfKwd))
{ {
GmfGetLin(meshID, gmfKwd, &iN[0] ); const int newID = *groupIDs.rbegin() + 1;
group->Add( shift + iN[0] ); groupIDs.insert( newID );
SMESHDS_Group* group = new SMESHDS_Group( newID, myMesh, entity );
group->SetStoreName( names[i] );
myMesh->AddGroup( group );
GmfGotoKwd(meshID, gmfKwd);
for ( int i = 0; i < nb; ++i )
{
GmfGetLin(meshID, gmfKwd, &iN[0] );
group->Add( shift + iN[0] );
}
} }
} }
} }

View File

@ -45,12 +45,19 @@ public:
DriverGMF_Read(); DriverGMF_Read();
~DriverGMF_Read(); ~DriverGMF_Read();
void SetMakeRequiredGroups( bool theMakeRequiredGroups )
{
_makeRequiredGroups = theMakeRequiredGroups;
}
virtual Status Perform(); virtual Status Perform();
private: private:
Status storeBadNodeIds(const char* gmfKwd, int elemNb, int nb, ...); Status storeBadNodeIds(const char* gmfKwd, int elemNb, int nb, ...);
bool _makeRequiredGroups;
}; };

View File

@ -24,11 +24,14 @@
// Author : Edward AGAPOV (eap) // Author : Edward AGAPOV (eap)
#include "DriverGMF_Write.hxx" #include "DriverGMF_Write.hxx"
#include "DriverGMF.hxx"
#include "SMESHDS_GroupBase.hxx" #include "SMESHDS_GroupBase.hxx"
#include "SMESHDS_Mesh.hxx" #include "SMESHDS_Mesh.hxx"
#include "SMESH_Comment.hxx" #include "SMESH_Comment.hxx"
#include <Basics_Utils.hxx>
extern "C" extern "C"
{ {
#include "libmesh5.h" #include "libmesh5.h"
@ -57,7 +60,7 @@ extern "C"
DriverGMF_Write::DriverGMF_Write(): DriverGMF_Write::DriverGMF_Write():
Driver_SMESHDS_Mesh() Driver_SMESHDS_Mesh(), _exportRequiredGroups( true )
{ {
} }
DriverGMF_Write::~DriverGMF_Write() DriverGMF_Write::~DriverGMF_Write()
@ -66,13 +69,20 @@ DriverGMF_Write::~DriverGMF_Write()
Driver_Mesh::Status DriverGMF_Write::Perform() Driver_Mesh::Status DriverGMF_Write::Perform()
{ {
const int dim = 3, version = 3; Kernel_Utils::Localizer loc;
const int dim = 3, version = sizeof(long) == 4 ? 2 : 3;
int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim ); int meshID = GmfOpenMesh( myFile.c_str(), GmfWrite, version, dim );
if ( !meshID ) if ( !meshID )
return addMessage( SMESH_Comment("Can't open for writing ") << myFile, /*fatal=*/true ); {
if ( DriverGMF::isExtensionCorrect( myFile ))
return addMessage( SMESH_Comment("Can't open for writing ") << myFile, /*fatal=*/true );
else
return addMessage( SMESH_Comment("Not '.mesh' or '.meshb' extension of file ") << myFile, /*fatal=*/true );
}
DriverGMF_MeshCloser aMeshCloser( meshID ); // An object closing GMF mesh at destruction DriverGMF::MeshCloser aMeshCloser( meshID ); // An object closing GMF mesh at destruction
// nodes // nodes
std::map< const SMDS_MeshNode* , int > node2IdMap; std::map< const SMDS_MeshNode* , int > node2IdMap;
@ -233,85 +243,88 @@ Driver_Mesh::Status DriverGMF_Write::Perform()
END_ELEM_WRITE( prism ); END_ELEM_WRITE( prism );
// required entities if ( _exportRequiredGroups )
SMESH_Comment badGroups;
const std::set<SMESHDS_GroupBase*>& groupSet = myMesh->GetGroups();
std::set<SMESHDS_GroupBase*>::const_iterator grIt = groupSet.begin();
for ( ; grIt != groupSet.end(); ++grIt )
{ {
const SMESHDS_GroupBase* group = *grIt; // required entities
std::string groupName = group->GetStoreName(); SMESH_Comment badGroups;
std::string::size_type pos = groupName.find( "_required_" ); const std::set<SMESHDS_GroupBase*>& groupSet = myMesh->GetGroups();
if ( pos == std::string::npos ) continue; std::set<SMESHDS_GroupBase*>::const_iterator grIt = groupSet.begin();
for ( ; grIt != groupSet.end(); ++grIt )
int gmfKwd;
SMDSAbs_EntityType smdsEntity;
std::string entity = groupName.substr( pos + strlen("_required_"));
if ( entity == "Vertices" ) {
gmfKwd = GmfRequiredVertices;
smdsEntity = SMDSEntity_Node;
}
else if ( entity == "Edges" ) {
gmfKwd = GmfRequiredEdges;
smdsEntity = SMDSEntity_Edge;
}
else if ( entity == "Triangles" ) {
gmfKwd = GmfRequiredTriangles;
smdsEntity = SMDSEntity_Triangle;
}
else if ( entity == "Quadrilaterals" ) {
gmfKwd = GmfRequiredQuadrilaterals;
smdsEntity = SMDSEntity_Quadrangle;
}
else {
addMessage( SMESH_Comment("Invalig gmf entity name: ") << entity, /*fatal=*/false );
continue;
}
// check elem type in the group
int nbOkElems = 0;
SMDS_ElemIteratorPtr elemIt = group->GetElements();
while ( elemIt->more() )
nbOkElems += ( elemIt->next()->GetEntityType() == smdsEntity );
if ( nbOkElems != group->Extent() && nbOkElems == 0 )
{ {
badGroups << " " << groupName; const SMESHDS_GroupBase* group = *grIt;
continue; std::string groupName = group->GetStoreName();
} std::string::size_type pos = groupName.find( "_required_" );
if ( pos == std::string::npos ) continue;
// choose a TElem2IDMap int gmfKwd;
TElem2IDMap* elem2IDMap = 0; SMDSAbs_EntityType smdsEntity;
if ( smdsEntity == SMDSEntity_Quadrangle && nbOkElems != myMesh->NbFaces() ) std::string entity = groupName.substr( pos + strlen("_required_"));
elem2IDMap = & quad2IDMap; if ( entity == "Vertices" ) {
else if ( smdsEntity == SMDSEntity_Triangle && nbOkElems != myMesh->NbFaces() ) gmfKwd = GmfRequiredVertices;
elem2IDMap = & tria2IDMap; smdsEntity = SMDSEntity_Node;
else if ( smdsEntity == SMDSEntity_Edge && nbOkElems != myMesh->NbEdges() )
elem2IDMap = & edge2IDMap;
// write the group
GmfSetKwd( meshID, gmfKwd, nbOkElems );
elemIt = group->GetElements();
if ( elem2IDMap )
for ( ; elemIt->more(); )
{
const SMDS_MeshElement* elem = elemIt->next();
if ( elem->GetEntityType() == smdsEntity )
GmfSetLin( meshID, gmfKwd, (*elem2IDMap)[ elem ] );
} }
else else if ( entity == "Edges" ) {
for ( int gmfID = 1; elemIt->more(); ++gmfID) gmfKwd = GmfRequiredEdges;
{ smdsEntity = SMDSEntity_Edge;
const SMDS_MeshElement* elem = elemIt->next(); }
if ( elem->GetEntityType() == smdsEntity ) else if ( entity == "Triangles" ) {
GmfSetLin( meshID, gmfKwd, gmfID ); gmfKwd = GmfRequiredTriangles;
smdsEntity = SMDSEntity_Triangle;
}
else if ( entity == "Quadrilaterals" ) {
gmfKwd = GmfRequiredQuadrilaterals;
smdsEntity = SMDSEntity_Quadrangle;
}
else {
addMessage( SMESH_Comment("Invalig gmf entity name: ") << entity, /*fatal=*/false );
continue;
} }
} // loop on groups // check elem type in the group
int nbOkElems = 0;
SMDS_ElemIteratorPtr elemIt = group->GetElements();
while ( elemIt->more() )
nbOkElems += ( elemIt->next()->GetEntityType() == smdsEntity );
if ( !badGroups.empty() ) if ( nbOkElems != group->Extent() && nbOkElems == 0 )
addMessage( SMESH_Comment("Groups of elements of inappropriate geometry:") {
<< badGroups, /*fatal=*/false ); badGroups << " " << groupName;
continue;
}
// choose a TElem2IDMap
TElem2IDMap* elem2IDMap = 0;
if ( smdsEntity == SMDSEntity_Quadrangle && nbOkElems != myMesh->NbFaces() )
elem2IDMap = & quad2IDMap;
else if ( smdsEntity == SMDSEntity_Triangle && nbOkElems != myMesh->NbFaces() )
elem2IDMap = & tria2IDMap;
else if ( smdsEntity == SMDSEntity_Edge && nbOkElems != myMesh->NbEdges() )
elem2IDMap = & edge2IDMap;
// write the group
GmfSetKwd( meshID, gmfKwd, nbOkElems );
elemIt = group->GetElements();
if ( elem2IDMap )
for ( ; elemIt->more(); )
{
const SMDS_MeshElement* elem = elemIt->next();
if ( elem->GetEntityType() == smdsEntity )
GmfSetLin( meshID, gmfKwd, (*elem2IDMap)[ elem ] );
}
else
for ( int gmfID = 1; elemIt->more(); ++gmfID)
{
const SMDS_MeshElement* elem = elemIt->next();
if ( elem->GetEntityType() == smdsEntity )
GmfSetLin( meshID, gmfKwd, gmfID );
}
} // loop on groups
if ( !badGroups.empty() )
addMessage( SMESH_Comment("Groups of elements of inappropriate geometry:")
<< badGroups, /*fatal=*/false );
}
return DRS_OK; return DRS_OK;
} }

View File

@ -42,18 +42,16 @@ public:
DriverGMF_Write(); DriverGMF_Write();
~DriverGMF_Write(); ~DriverGMF_Write();
void SetExportRequiredGroups( bool toExport )
{
_exportRequiredGroups = toExport;
}
virtual Status Perform(); virtual Status Perform();
};
/*! private:
* \brief An object closing GMF mesh at destruction
*/
struct DriverGMF_MeshCloser
{
int _gmfMeshID;
DriverGMF_MeshCloser( const int gmfMeshID ): _gmfMeshID(gmfMeshID) {}
~DriverGMF_MeshCloser();
};
bool _exportRequiredGroups;
};
#endif #endif

View File

@ -23,6 +23,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
salomeinclude_HEADERS = \ salomeinclude_HEADERS = \
DriverGMF_Read.hxx \ DriverGMF_Read.hxx \
DriverGMF_Write.hxx \ DriverGMF_Write.hxx \
DriverGMF.hxx \
SMESH_DriverGMF.hxx \ SMESH_DriverGMF.hxx \
libmesh5.h libmesh5.h
@ -31,20 +32,22 @@ lib_LTLIBRARIES = libMeshDriverGMF.la
dist_libMeshDriverGMF_la_SOURCES = \ dist_libMeshDriverGMF_la_SOURCES = \
DriverGMF_Read.cxx \ DriverGMF_Read.cxx \
DriverGMF_Write.cxx \ DriverGMF_Write.cxx \
DriverGMF.cxx \
libmesh5.c libmesh5.c
# additionnal information to compil and link file # additionnal information to compil and link file
libMeshDriverGMF_la_CPPFLAGS = \ libMeshDriverGMF_la_CPPFLAGS = \
$(KERNEL_CXXFLAGS) \ $(KERNEL_CXXFLAGS) \
$(CAS_CPPFLAGS) \ $(CAS_CPPFLAGS) \
$(VTK_INCLUDES) \ $(VTK_INCLUDES) \
$(BOOST_CPPFLAGS) \ $(BOOST_CPPFLAGS) -DBOOST_SYSTEM_NO_DEPRECATED \
-I$(srcdir)/../Driver \ -I$(srcdir)/../Driver \
-I$(srcdir)/../SMESHUtils \ -I$(srcdir)/../SMESHUtils \
-I$(srcdir)/../SMDS \ -I$(srcdir)/../SMDS \
-I$(srcdir)/../SMESHDS -I$(srcdir)/../SMESHDS
libMeshDriverGMF_la_LDFLAGS = \ libMeshDriverGMF_la_LDFLAGS = \
$(BOOST_LIBS) \ $(BOOST_LIBS) -lboost_filesystem \
../Driver/libMeshDriver.la \ ../Driver/libMeshDriver.la \
../SMESHUtils/libSMESHUtils.la ../SMESHUtils/libSMESHUtils.la \
$(KERNEL_LDFLAGS) -lSALOMEBasics

View File

@ -22,8 +22,8 @@
// Author : Edward AGAPOV (eap) // Author : Edward AGAPOV (eap)
// Executable to find out a lower RAM limit (MB), i.e. at what size of freeRAM // Executable to find out a lower RAM limit (MB), i.e. at what size of freeRAM
// reported by sysinfo, no more memory can be allocated. // reported by sysinfo, no more memory can be allocated.
// This is not done inside a function of SALOME because allocated memory is not returned // This is not done inside a function of SALOME because allocated memory is not always
// to the system. (PAL16631) // returned to the system. (PAL16631)
// //
#ifndef WIN32 #ifndef WIN32
#include <sys/sysinfo.h> #include <sys/sysinfo.h>

View File

@ -155,7 +155,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
// check for preview dimension limitations // check for preview dimension limitations
if ( aShapesId && GetShapeDim( aShType ) > (int)aDim ) if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
{ {
// clear compute state to not show previous compute errors // clear compute state not to show previous compute errors
// if preview invoked less dimension less than previous // if preview invoked less dimension less than previous
smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
continue; continue;
@ -355,23 +355,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
MEMOSTAT; MEMOSTAT;
SMESHDS_Mesh *myMesh = aMesh.GetMeshDS(); SMESHDS_Mesh *myMesh = aMesh.GetMeshDS();
myMesh->adjustStructure();
MESSAGE("*** compactMesh after compute"); MESSAGE("*** compactMesh after compute");
myMesh->compactMesh(); myMesh->compactMesh();
//myMesh->adjustStructure();
list<int> listind = myMesh->SubMeshIndices();
list<int>::iterator it = listind.begin();
int total = 0;
for(; it != listind.end(); ++it)
{
::SMESHDS_SubMesh *subMesh = myMesh->MeshElements(*it);
total += subMesh->getSize();
}
MESSAGE("total elements and nodes in submesh sets:" << total);
MESSAGE("Number of node objects " << SMDS_MeshNode::nbNodes);
MESSAGE("Number of cell objects " << SMDS_MeshCell::nbCells);
//myMesh->dumpGrid();
//aMesh.GetMeshDS()->Modified();
// fix quadratic mesh by bending iternal links near concave boundary // fix quadratic mesh by bending iternal links near concave boundary
if ( aShape.IsSame( aMesh.GetShapeToMesh() ) && if ( aShape.IsSame( aMesh.GetShapeToMesh() ) &&
@ -589,6 +574,8 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
if ( aLocIgnoAlgo ) // algo is hidden by a local algo of upper dim if ( aLocIgnoAlgo ) // algo is hidden by a local algo of upper dim
{ {
theErrors.push_back( SMESH_Gen::TAlgoStateError() );
theErrors.back().Set( SMESH_Hypothesis::HYP_HIDDEN_ALGO, algo, false );
INFOS( "Local <" << algo->GetName() << "> is hidden by local <" INFOS( "Local <" << algo->GetName() << "> is hidden by local <"
<< aLocIgnoAlgo->GetName() << ">"); << aLocIgnoAlgo->GetName() << ">");
} }
@ -598,9 +585,12 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
int dim = algo->GetDim(); int dim = algo->GetDim();
int aMaxGlobIgnoDim = ( aGlobIgnoAlgo ? aGlobIgnoAlgo->GetDim() : -1 ); int aMaxGlobIgnoDim = ( aGlobIgnoAlgo ? aGlobIgnoAlgo->GetDim() : -1 );
if ( dim < aMaxGlobIgnoDim ) if ( dim < aMaxGlobIgnoDim &&
( isGlobal || !aGlobIgnoAlgo->SupportSubmeshes() ))
{ {
// algo is hidden by a global algo // algo is hidden by a global algo
theErrors.push_back( SMESH_Gen::TAlgoStateError() );
theErrors.back().Set( SMESH_Hypothesis::HYP_HIDDEN_ALGO, algo, true );
INFOS( ( isGlobal ? "Global" : "Local" ) INFOS( ( isGlobal ? "Global" : "Local" )
<< " <" << algo->GetName() << "> is hidden by global <" << " <" << algo->GetName() << "> is hidden by global <"
<< aGlobIgnoAlgo->GetName() << ">"); << aGlobIgnoAlgo->GetName() << ">");
@ -680,7 +670,7 @@ static bool checkMissing(SMESH_Gen* aGen,
} }
case SMESH_subMesh::MISSING_HYP: { case SMESH_subMesh::MISSING_HYP: {
// notify if an algo missing hyp is attached to aSubMesh // notify if an algo missing hyp is attached to aSubMesh
algo = aGen->GetAlgo( aMesh, aSubMesh->GetSubShape() ); algo = aSubMesh->GetAlgo();
ASSERT( algo ); ASSERT( algo );
bool IsGlobalHypothesis = aGen->IsGlobalHypothesis( algo, aMesh ); bool IsGlobalHypothesis = aGen->IsGlobalHypothesis( algo, aMesh );
if (!IsGlobalHypothesis || !globalChecked[ algo->GetDim() ]) if (!IsGlobalHypothesis || !globalChecked[ algo->GetDim() ])
@ -731,7 +721,7 @@ static bool checkMissing(SMESH_Gen* aGen,
{ {
bool checkNoAlgo2 = ( algo->NeedDiscreteBoundary() ); bool checkNoAlgo2 = ( algo->NeedDiscreteBoundary() );
SMESH_subMeshIteratorPtr itsub = aSubMesh->getDependsOnIterator( /*includeSelf=*/false, SMESH_subMeshIteratorPtr itsub = aSubMesh->getDependsOnIterator( /*includeSelf=*/false,
/*complexShapeFirst=*/false); /*complexShapeFirst=*/true);
while ( itsub->more() ) while ( itsub->more() )
{ {
// sub-meshes should not be checked further more // sub-meshes should not be checked further more
@ -823,7 +813,8 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
for (dim = 3; dim > 0; dim--) for (dim = 3; dim > 0; dim--)
{ {
if (aGlobAlgoArr[ dim ] && if (aGlobAlgoArr[ dim ] &&
!aGlobAlgoArr[ dim ]->NeedDiscreteBoundary()) !aGlobAlgoArr[ dim ]->NeedDiscreteBoundary() /*&&
!aGlobAlgoArr[ dim ]->SupportSubmeshes()*/ )
{ {
aGlobIgnoAlgo = aGlobAlgoArr[ dim ]; aGlobIgnoAlgo = aGlobAlgoArr[ dim ];
break; break;
@ -880,14 +871,13 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX) if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
break; break;
if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim,
if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim, globalChecked, checkNoAlgo, aCheckedSubs, theErrors))
globalChecked, checkNoAlgo, aCheckedSubs, theErrors)) {
{ ret = false;
ret = false; if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO )
if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO ) checkNoAlgo = false;
checkNoAlgo = false; }
}
} }
if ( !hasAlgo ) { if ( !hasAlgo ) {

View File

@ -24,7 +24,6 @@
// File : SMESH_Hypothesis.cxx // File : SMESH_Hypothesis.cxx
// Author : Paul RASCLE, EDF // Author : Paul RASCLE, EDF
// Module : SMESH // Module : SMESH
// $Header$
// //
#include "SMESH_Hypothesis.hxx" #include "SMESH_Hypothesis.hxx"
#include "SMESH_Gen.hxx" #include "SMESH_Gen.hxx"
@ -50,8 +49,6 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
_type = PARAM_ALGO; _type = PARAM_ALGO;
_shapeType = 0; // to be set by algo with TopAbs_Enum _shapeType = 0; // to be set by algo with TopAbs_Enum
_param_algo_dim = -1; // to be set by algo parameter _param_algo_dim = -1; // to be set by algo parameter
//_parameters = string();
//_lastParameters = string();
} }
//============================================================================= //=============================================================================
@ -171,59 +168,3 @@ SMESH_Mesh* SMESH_Hypothesis::GetMeshByPersistentID(int id)
} }
return 0; return 0;
} }
//=============================================================================
/*!
*
*/
//=============================================================================
// void SMESH_Hypothesis::SetParameters(const char *theParameters)
// {
// string aNewParameters(theParameters);
// if(aNewParameters.size()==0 && _parameters.size()==0)
// aNewParameters = " ";
// if(_parameters.size()>0)
// _parameters +="|";
// _parameters +=aNewParameters;
// SetLastParameters(theParameters);
// }
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
// void SMESH_Hypothesis::ClearParameters()
// {
// _parameters = string();
// }
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
// char* SMESH_Hypothesis::GetParameters() const
// {
// return (char*)_parameters.c_str();
// }
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
// char* SMESH_Hypothesis::GetLastParameters() const
// {
// return (char*)_lastParameters.c_str();
// }
// //=============================================================================
// /*!
// *
// */
// //=============================================================================
// void SMESH_Hypothesis::SetLastParameters(const char* theParameters)
// {
// _lastParameters = string(theParameters);
// }

View File

@ -347,16 +347,32 @@ void SMESH_Mesh::Load()
void SMESH_Mesh::Clear() void SMESH_Mesh::Clear()
{ {
// clear mesh data if ( HasShapeToMesh() ) // remove all nodes and elements
_myMeshDS->ClearMesh();
// update compute state of submeshes
if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) )
{ {
sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); // clear mesh data
sm->ComputeSubMeshStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); _myMeshDS->ClearMesh();
sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); // for event listeners (issue 0020918)
sm->ComputeSubMeshStateEngine( SMESH_subMesh::CLEAN ); // update compute state of submeshes
if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) )
{
sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
sm->ComputeSubMeshStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
sm->ComputeStateEngine( SMESH_subMesh::CLEAN ); // for event listeners (issue 0020918)
sm->ComputeSubMeshStateEngine( SMESH_subMesh::CLEAN );
}
}
else // remove only nodes/elements computed by algorithms
{
if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) )
{
SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true,
/*complexShapeFirst=*/true);
while ( smIt->more() )
{
sm = smIt->next();
sm->ComputeStateEngine( SMESH_subMesh::CLEAN );
}
}
} }
_isModified = false; _isModified = false;
} }
@ -545,11 +561,13 @@ int SMESH_Mesh::CGNSToMesh(const char* theFileName,
*/ */
//================================================================================ //================================================================================
SMESH_ComputeErrorPtr SMESH_Mesh::GMFToMesh(const char* theFileName) SMESH_ComputeErrorPtr SMESH_Mesh::GMFToMesh(const char* theFileName,
bool theMakeRequiredGroups)
{ {
DriverGMF_Read myReader; DriverGMF_Read myReader;
myReader.SetMesh(_myMeshDS); myReader.SetMesh(_myMeshDS);
myReader.SetFile(theFileName); myReader.SetFile(theFileName);
myReader.SetMakeRequiredGroups( theMakeRequiredGroups );
myReader.Perform(); myReader.Perform();
//theMeshName = myReader.GetMeshName(); //theMeshName = myReader.GetMeshName();
@ -1419,11 +1437,14 @@ void SMESH_Mesh::ExportCGNS(const char * file,
//================================================================================ //================================================================================
void SMESH_Mesh::ExportGMF(const char * file, void SMESH_Mesh::ExportGMF(const char * file,
const SMESHDS_Mesh* meshDS) const SMESHDS_Mesh* meshDS,
bool withRequiredGroups)
{ {
DriverGMF_Write myWriter; DriverGMF_Write myWriter;
myWriter.SetFile( file ); myWriter.SetFile( file );
myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS )); myWriter.SetMesh( const_cast<SMESHDS_Mesh*>( meshDS ));
myWriter.SetExportRequiredGroups( withRequiredGroups );
myWriter.Perform(); myWriter.Perform();
} }
@ -1999,7 +2020,9 @@ void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape)
{ {
// a geom group is added. Insert it into lists of ancestors before // a geom group is added. Insert it into lists of ancestors before
// the first ancestor more complex than group members // the first ancestor more complex than group members
int memberType = TopoDS_Iterator( theShape ).Value().ShapeType(); TopoDS_Iterator subIt( theShape );
if ( !subIt.More() ) return;
int memberType = subIt.Value().ShapeType();
for ( desType = TopAbs_VERTEX; desType >= memberType; desType-- ) for ( desType = TopAbs_VERTEX; desType >= memberType; desType-- )
for (TopExp_Explorer des( theShape, TopAbs_ShapeEnum( desType )); des.More(); des.Next()) for (TopExp_Explorer des( theShape, TopAbs_ShapeEnum( desType )); des.More(); des.Next())
{ {

View File

@ -122,7 +122,8 @@ public:
int CGNSToMesh(const char* theFileName, const int theMeshIndex, std::string& theMeshName); int CGNSToMesh(const char* theFileName, const int theMeshIndex, std::string& theMeshName);
SMESH_ComputeErrorPtr GMFToMesh(const char* theFileName); SMESH_ComputeErrorPtr GMFToMesh(const char* theFileName,
bool theMakeRequiredGroups = true );
SMESH_Hypothesis::Hypothesis_Status SMESH_Hypothesis::Hypothesis_Status
AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId) AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
@ -244,7 +245,8 @@ public:
void ExportCGNS(const char * file, void ExportCGNS(const char * file,
const SMESHDS_Mesh* mesh); const SMESHDS_Mesh* mesh);
void ExportGMF(const char * file, void ExportGMF(const char * file,
const SMESHDS_Mesh* mesh); const SMESHDS_Mesh* mesh,
bool withRequiredGroups = true );
void ExportSAUV(const char *file, void ExportSAUV(const char *file,
const char* theMeshName = NULL, const char* theMeshName = NULL,
bool theAutoGroups = true) throw(SALOME_Exception); bool theAutoGroups = true) throw(SALOME_Exception);

View File

@ -120,6 +120,19 @@ SMESH_MeshEditor::SMESH_MeshEditor( SMESH_Mesh* theMesh )
{ {
} }
//================================================================================
/*!
* \brief Clears myLastCreatedNodes and myLastCreatedElems
*/
//================================================================================
void SMESH_MeshEditor::CrearLastCreated()
{
myLastCreatedNodes.Clear();
myLastCreatedElems.Clear();
}
//======================================================================= //=======================================================================
/*! /*!
* \brief Add element * \brief Add element
@ -389,6 +402,44 @@ int SMESH_MeshEditor::Remove (const list< int >& theIDs,
return removed; return removed;
} }
//================================================================================
/*!
* \brief Create 0D elements on all nodes of the given object except those
* nodes on which a 0D element already exists.
* \param elements - Elements on whose nodes to create 0D elements; if empty,
* the all mesh is treated
* \param all0DElems - returns all 0D elements found or created on nodes of \a elements
*/
//================================================================================
void SMESH_MeshEditor::Create0DElementsOnAllNodes( const TIDSortedElemSet& elements,
TIDSortedElemSet& all0DElems )
{
typedef SMDS_SetIterator<const SMDS_MeshElement*, TIDSortedElemSet::const_iterator> TSetIterator;
SMDS_ElemIteratorPtr elemIt;
if ( elements.empty() )
elemIt = GetMeshDS()->elementsIterator( SMDSAbs_Node );
else
elemIt = SMDS_ElemIteratorPtr( new TSetIterator( elements.begin(), elements.end() ));
while ( elemIt->more() )
{
const SMDS_MeshElement* e = elemIt->next();
SMDS_ElemIteratorPtr nodeIt = e->nodesIterator();
while ( nodeIt->more() )
{
const SMDS_MeshNode* n = cast2Node( nodeIt->next() );
SMDS_ElemIteratorPtr it0D = n->GetInverseElementIterator( SMDSAbs_0DElement );
if ( it0D->more() )
all0DElems.insert( it0D->next() );
else {
myLastCreatedElems.Append( GetMeshDS()->Add0DElement( n ));
all0DElems.insert( myLastCreatedElems.Last() );
}
}
}
}
//======================================================================= //=======================================================================
//function : FindShape //function : FindShape
//purpose : Return an index of the shape theElem is on //purpose : Return an index of the shape theElem is on
@ -1065,7 +1116,7 @@ bool SMESH_MeshEditor::Reorient (const SMDS_MeshElement * theElem)
* \brief Reorient faces. * \brief Reorient faces.
* \param theFaces - the faces to reorient. If empty the whole mesh is meant * \param theFaces - the faces to reorient. If empty the whole mesh is meant
* \param theDirection - desired direction of normal of \a theFace * \param theDirection - desired direction of normal of \a theFace
* \param theFace - one of \a theFaces that sould be orientated according to * \param theFace - one of \a theFaces that sould be oriented according to
* \a theDirection and whose orientation defines orientation of other faces * \a theDirection and whose orientation defines orientation of other faces
* \return number of reoriented faces. * \return number of reoriented faces.
*/ */
@ -1093,7 +1144,7 @@ int SMESH_MeshEditor::Reorient2D (TIDSortedElemSet & theFaces,
// Orient other faces // Orient other faces
set< const SMDS_MeshElement* > startFaces; set< const SMDS_MeshElement* > startFaces, visitedFaces;
TIDSortedElemSet avoidSet; TIDSortedElemSet avoidSet;
set< SMESH_TLink > checkedLinks; set< SMESH_TLink > checkedLinks;
pair< set< SMESH_TLink >::iterator, bool > linkIt_isNew; pair< set< SMESH_TLink >::iterator, bool > linkIt_isNew;
@ -1102,16 +1153,26 @@ int SMESH_MeshEditor::Reorient2D (TIDSortedElemSet & theFaces,
theFaces.erase( theFace ); theFaces.erase( theFace );
startFaces.insert( theFace ); startFaces.insert( theFace );
int nodeInd1, nodeInd2;
const SMDS_MeshElement* otherFace;
vector< const SMDS_MeshElement* > facesNearLink;
vector< std::pair< int, int > > nodeIndsOfFace;
set< const SMDS_MeshElement* >::iterator startFace = startFaces.begin(); set< const SMDS_MeshElement* >::iterator startFace = startFaces.begin();
while ( startFace != startFaces.end() ) while ( !startFaces.empty() )
{ {
startFace = startFaces.begin();
theFace = *startFace; theFace = *startFace;
const int nbNodes = theFace->NbCornerNodes(); startFaces.erase( startFace );
if ( !visitedFaces.insert( theFace ).second )
continue;
avoidSet.clear(); avoidSet.clear();
avoidSet.insert(theFace); avoidSet.insert(theFace);
NLink link( theFace->GetNode( 0 ), 0 ); NLink link( theFace->GetNode( 0 ), 0 );
const int nbNodes = theFace->NbCornerNodes();
for ( int i = 0; i < nbNodes; ++i ) // loop on links of theFace for ( int i = 0; i < nbNodes; ++i ) // loop on links of theFace
{ {
link.second = theFace->GetNode(( i+1 ) % nbNodes ); link.second = theFace->GetNode(( i+1 ) % nbNodes );
@ -1120,33 +1181,61 @@ int SMESH_MeshEditor::Reorient2D (TIDSortedElemSet & theFaces,
{ {
// link has already been checked and won't be encountered more // link has already been checked and won't be encountered more
// if the group (theFaces) is manifold // if the group (theFaces) is manifold
checkedLinks.erase( linkIt_isNew.first ); //checkedLinks.erase( linkIt_isNew.first );
} }
else else
{ {
int nodeInd1, nodeInd2; facesNearLink.clear();
const SMDS_MeshElement* otherFace = FindFaceInSet( link.first, link.second, nodeIndsOfFace.clear();
theFaces, avoidSet, while (( otherFace = FindFaceInSet( link.first, link.second,
& nodeInd1, & nodeInd2); theFaces, avoidSet, &nodeInd1, &nodeInd2 )))
if ( otherFace != theFace)
{
facesNearLink.push_back( otherFace );
nodeIndsOfFace.push_back( make_pair( nodeInd1, nodeInd2 ));
avoidSet.insert( otherFace );
}
if ( facesNearLink.size() > 1 )
{
// NON-MANIFOLD mesh shell !
// select a face most co-directed with theFace,
// other faces won't be visited this time
gp_XYZ NF, NOF;
SMESH_Algo::FaceNormal( theFace, NF, /*normalized=*/false );
double proj, maxProj = -1;
for ( size_t i = 0; i < facesNearLink.size(); ++i ) {
SMESH_Algo::FaceNormal( facesNearLink[i], NOF, /*normalized=*/false );
if (( proj = Abs( NF * NOF )) > maxProj ) {
maxProj = proj;
otherFace = facesNearLink[i];
nodeInd1 = nodeIndsOfFace[i].first;
nodeInd2 = nodeIndsOfFace[i].second;
}
}
// not to visit rejected faces
for ( size_t i = 0; i < facesNearLink.size(); ++i )
if ( facesNearLink[i] != otherFace && theFaces.size() > 1 )
visitedFaces.insert( facesNearLink[i] );
}
else if ( facesNearLink.size() == 1 )
{
otherFace = facesNearLink[0];
nodeInd1 = nodeIndsOfFace.back().first;
nodeInd2 = nodeIndsOfFace.back().second;
}
if ( otherFace && otherFace != theFace) if ( otherFace && otherFace != theFace)
{ {
// link must be reversed in otherFace if orientation ot otherFace // link must be reverse in otherFace if orientation ot otherFace
// is same as that of theFace // is same as that of theFace
if ( abs(nodeInd2-nodeInd1) == 1 ? nodeInd2 > nodeInd1 : nodeInd1 > nodeInd2 ) if ( abs(nodeInd2-nodeInd1) == 1 ? nodeInd2 > nodeInd1 : nodeInd1 > nodeInd2 )
{ {
// cout << "Reorient " << otherFace->GetID() << " near theFace=" <<theFace->GetID()
// << " \tlink( " << link.first->GetID() << " " << link.second->GetID() << endl;
nbReori += Reorient( otherFace ); nbReori += Reorient( otherFace );
} }
startFaces.insert( otherFace ); startFaces.insert( otherFace );
if ( theFaces.size() > 1 ) // leave 1 face to prevent finding not selected faces
theFaces.erase( otherFace );
} }
} }
std::swap( link.first, link.second ); std::swap( link.first, link.second ); // reverse the link
} }
startFaces.erase( startFace );
startFace = startFaces.begin();
} }
return nbReori; return nbReori;
} }
@ -1216,7 +1305,8 @@ bool SMESH_MeshEditor::QuadToTri (TIDSortedElemSet & theElems,
if( !elem->IsQuadratic() ) { if( !elem->IsQuadratic() ) {
// split liner quadrangle // split liner quadrangle
// for MaxElementLength2D functor we return minimum diagonal for splitting,
// because aBadRate1=2*len(diagonal 1-3); aBadRate2=2*len(diagonal 2-4)
if ( aBadRate1 <= aBadRate2 ) { if ( aBadRate1 <= aBadRate2 ) {
// tr1 + tr2 is better // tr1 + tr2 is better
newElem1 = aMesh->AddFace( aNodes[2], aNodes[3], aNodes[0] ); newElem1 = aMesh->AddFace( aNodes[2], aNodes[3], aNodes[0] );
@ -1350,7 +1440,8 @@ int SMESH_MeshEditor::BestSplit (const SMDS_MeshElement* theQuad,
SMDS_FaceOfNodes tr3 ( aNodes[1], aNodes[2], aNodes[3] ); SMDS_FaceOfNodes tr3 ( aNodes[1], aNodes[2], aNodes[3] );
SMDS_FaceOfNodes tr4 ( aNodes[3], aNodes[0], aNodes[1] ); SMDS_FaceOfNodes tr4 ( aNodes[3], aNodes[0], aNodes[1] );
aBadRate2 = getBadRate( &tr3, theCrit ) + getBadRate( &tr4, theCrit ); aBadRate2 = getBadRate( &tr3, theCrit ) + getBadRate( &tr4, theCrit );
// for MaxElementLength2D functor we return minimum diagonal for splitting,
// because aBadRate1=2*len(diagonal 1-3); aBadRate2=2*len(diagonal 2-4)
if (aBadRate1 <= aBadRate2) // tr1 + tr2 is better if (aBadRate1 <= aBadRate2) // tr1 + tr2 is better
return 1; // diagonal 1-3 return 1; // diagonal 1-3
@ -3062,7 +3153,7 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems,
SMDS_FaceIteratorPtr fIt = aMesh->facesIterator(); SMDS_FaceIteratorPtr fIt = aMesh->facesIterator();
while ( fIt->more() ) { while ( fIt->more() ) {
const SMDS_MeshElement* face = fIt->next(); const SMDS_MeshElement* face = fIt->next();
theElems.insert( face ); theElems.insert( theElems.end(), face );
} }
} }
// get all face ids theElems are on // get all face ids theElems are on
@ -5082,10 +5173,16 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
if ( BRep_Tool::Degenerated( aTrackEdge ) ) if ( BRep_Tool::Degenerated( aTrackEdge ) )
return EXTR_BAD_PATH_SHAPE; return EXTR_BAD_PATH_SHAPE;
TopExp::Vertices( aTrackEdge, aV1, aV2 ); TopExp::Vertices( aTrackEdge, aV1, aV2 );
aItN = theTrack->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes(); const SMDS_MeshNode* aN1 = 0;
const SMDS_MeshNode* aN1 = aItN->next(); const SMDS_MeshNode* aN2 = 0;
aItN = theTrack->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes(); if ( theTrack->GetSubMesh( aV1 ) && theTrack->GetSubMesh( aV1 )->GetSubMeshDS() ) {
const SMDS_MeshNode* aN2 = aItN->next(); aItN = theTrack->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes();
aN1 = aItN->next();
}
if ( theTrack->GetSubMesh( aV2 ) && theTrack->GetSubMesh( aV2 )->GetSubMeshDS() ) {
aItN = theTrack->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes();
aN2 = aItN->next();
}
// starting node must be aN1 or aN2 // starting node must be aN1 or aN2
if ( !( aN1 == theN1 || aN2 == theN1 ) ) if ( !( aN1 == theN1 || aN2 == theN1 ) )
return EXTR_BAD_STARTING_NODE; return EXTR_BAD_STARTING_NODE;
@ -5115,7 +5212,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
} }
} }
list< list<SMESH_MeshEditor_PathPoint> > LLPPs; list< list<SMESH_MeshEditor_PathPoint> > LLPPs;
int startNid = theN1->GetID(); TopoDS_Vertex aVprev;
TColStd_MapOfInteger UsedNums; TColStd_MapOfInteger UsedNums;
int NbEdges = Edges.Length(); int NbEdges = Edges.Length();
int i = 1; int i = 1;
@ -5129,17 +5226,37 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
SMESH_subMesh* locTrack = *itLSM; SMESH_subMesh* locTrack = *itLSM;
SMESHDS_SubMesh* locMeshDS = locTrack->GetSubMeshDS(); SMESHDS_SubMesh* locMeshDS = locTrack->GetSubMeshDS();
TopExp::Vertices( aTrackEdge, aV1, aV2 ); TopExp::Vertices( aTrackEdge, aV1, aV2 );
aItN = locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS()->GetNodes(); bool aN1isOK = false, aN2isOK = false;
const SMDS_MeshNode* aN1 = aItN->next(); if ( aVprev.IsNull() ) {
aItN = locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS()->GetNodes(); // if previous vertex is not yet defined, it means that we in the beginning of wire
const SMDS_MeshNode* aN2 = aItN->next(); // and we have to find initial vertex corresponding to starting node theN1
// starting node must be aN1 or aN2 const SMDS_MeshNode* aN1 = 0;
if ( !( aN1->GetID() == startNid || aN2->GetID() == startNid ) ) continue; const SMDS_MeshNode* aN2 = 0;
if ( locTrack->GetFather()->GetSubMesh(aV1) && locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS() ) {
aItN = locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS()->GetNodes();
aN1 = aItN->next();
}
if ( locTrack->GetFather()->GetSubMesh(aV2) && locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS() ) {
aItN = locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS()->GetNodes();
aN2 = aItN->next();
}
// starting node must be aN1 or aN2
aN1isOK = ( aN1 && aN1 == theN1 );
aN2isOK = ( aN2 && aN2 == theN1 );
}
else {
// we have specified ending vertex of the previous edge on the previous iteration
// and we have just to check that it corresponds to any vertex in current segment
aN1isOK = aVprev.IsSame( aV1 );
aN2isOK = aVprev.IsSame( aV2 );
}
if ( !aN1isOK && !aN2isOK ) continue;
// 2. Collect parameters on the track edge // 2. Collect parameters on the track edge
aPrms.clear(); aPrms.clear();
aItN = locMeshDS->GetNodes(); aItN = locMeshDS->GetNodes();
while ( aItN->more() ) { while ( aItN->more() ) {
const SMDS_MeshNode* pNode = aItN->next(); const SMDS_MeshNode* pNode = aItN->next();
const SMDS_EdgePosition* pEPos = const SMDS_EdgePosition* pEPos =
static_cast<const SMDS_EdgePosition*>( pNode->GetPosition() ); static_cast<const SMDS_EdgePosition*>( pNode->GetPosition() );
double aT = pEPos->GetUParameter(); double aT = pEPos->GetUParameter();
@ -5147,12 +5264,12 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
} }
list<SMESH_MeshEditor_PathPoint> LPP; list<SMESH_MeshEditor_PathPoint> LPP;
//Extrusion_Error err = //Extrusion_Error err =
MakeEdgePathPoints(aPrms, aTrackEdge,(aN1->GetID()==startNid), LPP); MakeEdgePathPoints(aPrms, aTrackEdge, aN1isOK, LPP);
LLPPs.push_back(LPP); LLPPs.push_back(LPP);
UsedNums.Add(k); UsedNums.Add(k);
// update startN for search following egde // update startN for search following egde
if( aN1->GetID() == startNid ) startNid = aN2->GetID(); if ( aN1isOK ) aVprev = aV2;
else startNid = aN1->GetID(); else aVprev = aV1;
break; break;
} }
} }
@ -5171,8 +5288,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
SMESH_MeshEditor_PathPoint PP2 = currList.front(); SMESH_MeshEditor_PathPoint PP2 = currList.front();
gp_Dir D1 = PP1.Tangent(); gp_Dir D1 = PP1.Tangent();
gp_Dir D2 = PP2.Tangent(); gp_Dir D2 = PP2.Tangent();
gp_Dir Dnew( gp_Vec( (D1.X()+D2.X())/2, (D1.Y()+D2.Y())/2, gp_Dir Dnew( ( D1.XYZ() + D2.XYZ() ) / 2 );
(D1.Z()+D2.Z())/2 ) );
PP1.SetTangent(Dnew); PP1.SetTangent(Dnew);
fullList.push_back(PP1); fullList.push_back(PP1);
itPP++; itPP++;
@ -8156,6 +8272,7 @@ private:
//purpose : Return list of group of elements built on the same nodes. //purpose : Return list of group of elements built on the same nodes.
// Search among theElements or in the whole mesh if theElements is empty // Search among theElements or in the whole mesh if theElements is empty
//======================================================================= //=======================================================================
void SMESH_MeshEditor::FindEqualElements(TIDSortedElemSet & theElements, void SMESH_MeshEditor::FindEqualElements(TIDSortedElemSet & theElements,
TListOfListOfElementsID & theGroupsOfElementsID) TListOfListOfElementsID & theGroupsOfElementsID)
{ {

View File

@ -116,6 +116,7 @@ public:
const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; } const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; }
const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; } const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; }
void CrearLastCreated();
SMESH_ComputeErrorPtr & GetError() { return myError; } SMESH_ComputeErrorPtr & GetError() { return myError; }
@ -139,6 +140,12 @@ public:
// Remove a node or an element. // Remove a node or an element.
// Modify a compute state of sub-meshes which become empty // Modify a compute state of sub-meshes which become empty
void Create0DElementsOnAllNodes( const TIDSortedElemSet& elements,
TIDSortedElemSet& all0DElems);
// Create 0D elements on all nodes of the given object except those
// nodes on which a 0D element already exists. \a all0DElems returns
// all 0D elements found or created on nodes of \a elements
bool InverseDiag (const SMDS_MeshElement * theTria1, bool InverseDiag (const SMDS_MeshElement * theTria1,
const SMDS_MeshElement * theTria2 ); const SMDS_MeshElement * theTria2 );
// Replace two neighbour triangles with ones built on the same 4 nodes // Replace two neighbour triangles with ones built on the same 4 nodes

View File

@ -283,6 +283,18 @@ void SMESH_MesherHelper::SetSubShape(const TopoDS_Shape& aSh)
myDegenShapeIds.insert( meshDS->ShapeToIndex( v.Current() )); myDegenShapeIds.insert( meshDS->ShapeToIndex( v.Current() ));
} }
} }
if ( !myDegenShapeIds.empty() && !myParIndex ) {
if ( surface->IsUPeriodic() || surface->IsUClosed() ) {
myParIndex |= U_periodic;
myPar1[0] = surf.FirstUParameter();
myPar2[0] = surf.LastUParameter();
}
else if ( surface->IsVPeriodic() || surface->IsVClosed() ) {
myParIndex |= V_periodic;
myPar1[1] = surf.FirstVParameter();
myPar2[1] = surf.LastVParameter();
}
}
} }
} }
} }
@ -3428,7 +3440,7 @@ namespace { // Structures used by FixQuadraticElements()
*/ */
//======================================================================= //=======================================================================
void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& error, void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
bool volumeOnly) bool volumeOnly)
{ {
// setenv NO_FixQuadraticElements to know if FixQuadraticElements() is guilty of bad conversion // setenv NO_FixQuadraticElements to know if FixQuadraticElements() is guilty of bad conversion
@ -3462,7 +3474,8 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& error,
#endif #endif
SMESH_MesherHelper h(*myMesh); SMESH_MesherHelper h(*myMesh);
h.SetSubShape( s.Current() ); h.SetSubShape( s.Current() );
h.FixQuadraticElements( error, false ); h.ToFixNodeParameters(true);
h.FixQuadraticElements( compError, false );
} }
} }
// fix nodes on geom faces // fix nodes on geom faces
@ -3473,12 +3486,12 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& error,
MSG("FIX FACE " << nbfaces-- << " #" << GetMeshDS()->ShapeToIndex(fIt.Key())); MSG("FIX FACE " << nbfaces-- << " #" << GetMeshDS()->ShapeToIndex(fIt.Key()));
SMESH_MesherHelper h(*myMesh); SMESH_MesherHelper h(*myMesh);
h.SetSubShape( fIt.Key() ); h.SetSubShape( fIt.Key() );
h.FixQuadraticElements( error, true);
h.ToFixNodeParameters(true); h.ToFixNodeParameters(true);
h.FixQuadraticElements( compError, true);
} }
//perf_print_all_meters(1); //perf_print_all_meters(1);
if ( error && error->myName == EDITERR_NO_MEDIUM_ON_GEOM ) if ( compError && compError->myName == EDITERR_NO_MEDIUM_ON_GEOM )
error->myComment = "during conversion to quadratic, " compError->myComment = "during conversion to quadratic, "
"some medium nodes were not placed on geometry to avoid distorting elements"; "some medium nodes were not placed on geometry to avoid distorting elements";
return; return;
} }
@ -3521,7 +3534,7 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& error,
// Issue 0020982 // Issue 0020982
// Move medium nodes to the link middle for elements whose corner nodes // Move medium nodes to the link middle for elements whose corner nodes
// are out of geometrical boundary to fix distorted elements. // are out of geometrical boundary to fix distorted elements.
force3DOutOfBoundary( *this, error ); force3DOutOfBoundary( *this, compError );
if ( elemType == SMDSAbs_Volume ) if ( elemType == SMDSAbs_Volume )
{ {
@ -3595,7 +3608,9 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& error,
QLink link( face->GetNode(iN), face->GetNode((iN+1)%nbN), face->GetNode(iN+nbN) ); QLink link( face->GetNode(iN), face->GetNode((iN+1)%nbN), face->GetNode(iN+nbN) );
pLink = links.insert( link ).first; pLink = links.insert( link ).first;
faceLinks[ iN ] = & *pLink; faceLinks[ iN ] = & *pLink;
if ( !isCurved ) if ( !isCurved &&
link.node1()->GetPosition()->GetTypeOfPosition() < 2 &&
link.node2()->GetPosition()->GetTypeOfPosition() < 2 )
isCurved = !link.IsStraight(); isCurved = !link.IsStraight();
} }
// store QFace // store QFace

View File

@ -1133,7 +1133,7 @@ bool SMESH_subMesh::IsConform(const SMESH_Algo* theAlgo)
*/ */
//============================================================================= //=============================================================================
void SMESH_subMesh::setAlgoState(int state) void SMESH_subMesh::setAlgoState(algo_state state)
{ {
_algoState = state; _algoState = state;
} }
@ -2203,6 +2203,9 @@ void SMESH_subMesh::DeleteEventListener(EventListener* listener)
delete l_d->second; delete l_d->second;
} }
_eventListeners.erase( l_d ); _eventListeners.erase( l_d );
if ( l_d->first && !l_d->first->IsDeletable() )
l_d->first->myBusySM.erase( this );
} }
} }

View File

@ -65,7 +65,7 @@ class SMESH_EXPORT SMESH_subMesh
const TopoDS_Shape & aSubShape); const TopoDS_Shape & aSubShape);
virtual ~ SMESH_subMesh(); virtual ~ SMESH_subMesh();
int GetId() const; int GetId() const; // == meshDS->ShapeToIndex( aSubShape )
SMESH_Mesh* GetFather() { return _father; } SMESH_Mesh* GetFather() { return _father; }
@ -209,9 +209,9 @@ public:
SMESH_Hypothesis::Hypothesis_Status SMESH_Hypothesis::Hypothesis_Status
SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis * anHyp); SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis * anHyp);
int GetAlgoState() const { return _algoState; } algo_state GetAlgoState() const { return _algoState; }
int GetComputeState() const { return _computeState; }; compute_state GetComputeState() const { return _computeState; };
SMESH_ComputeErrorPtr& GetComputeError() { return _computeError; } SMESH_ComputeErrorPtr& GetComputeError() { return _computeError; }
void DumpAlgoState(bool isMain); void DumpAlgoState(bool isMain);
@ -275,7 +275,7 @@ protected:
void updateSubMeshState(const compute_state theState); void updateSubMeshState(const compute_state theState);
void cleanDependants(); void cleanDependants();
void cleanDependsOn(); void cleanDependsOn();
void setAlgoState(int state); void setAlgoState(algo_state state);
/*! /*!
* \brief Return a shape containing all sub-shapes of the MainShape that can be * \brief Return a shape containing all sub-shapes of the MainShape that can be
@ -314,8 +314,8 @@ protected:
std::map < int, SMESH_subMesh * >_mapDepend; std::map < int, SMESH_subMesh * >_mapDepend;
bool _dependenceAnalysed; bool _dependenceAnalysed;
int _algoState; algo_state _algoState;
int _computeState; compute_state _computeState;
SMESH_ComputeErrorPtr _computeError; SMESH_ComputeErrorPtr _computeError;
// allow algo->Compute() if a subshape of lower dim is meshed but // allow algo->Compute() if a subshape of lower dim is meshed but

View File

@ -97,6 +97,7 @@ salomeinclude_HEADERS = \
SMESHGUI_PreviewDlg.h \ SMESHGUI_PreviewDlg.h \
SMESHGUI_ReorientFacesDlg.h \ SMESHGUI_ReorientFacesDlg.h \
SMESHGUI_PropertiesDlg.h \ SMESHGUI_PropertiesDlg.h \
SMESHGUI_Add0DElemsOnAllNodesDlg.h \
SMESH_SMESHGUI.hxx SMESH_SMESHGUI.hxx
# Libraries targets # Libraries targets
@ -173,7 +174,8 @@ dist_libSMESH_la_SOURCES = \
SMESHGUI_FileValidator.cxx \ SMESHGUI_FileValidator.cxx \
SMESHGUI_PreviewDlg.cxx \ SMESHGUI_PreviewDlg.cxx \
SMESHGUI_ReorientFacesDlg.cxx \ SMESHGUI_ReorientFacesDlg.cxx \
SMESHGUI_PropertiesDlg.cxx SMESHGUI_PropertiesDlg.cxx \
SMESHGUI_Add0DElemsOnAllNodesDlg.cxx
MOC_FILES = \ MOC_FILES = \
SMESHGUI_moc.cxx \ SMESHGUI_moc.cxx \
@ -233,7 +235,8 @@ MOC_FILES = \
SMESHGUI_MeshOrderOp_moc.cxx \ SMESHGUI_MeshOrderOp_moc.cxx \
SMESHGUI_PreviewDlg_moc.cxx \ SMESHGUI_PreviewDlg_moc.cxx \
SMESHGUI_ReorientFacesDlg_moc.cxx \ SMESHGUI_ReorientFacesDlg_moc.cxx \
SMESHGUI_PropertiesDlg_moc.cxx SMESHGUI_PropertiesDlg_moc.cxx \
SMESHGUI_Add0DElemsOnAllNodesDlg_moc.cxx
nodist_libSMESH_la_SOURCES= \ nodist_libSMESH_la_SOURCES= \
$(MOC_FILES) $(MOC_FILES)

View File

@ -27,18 +27,21 @@
#undef HAVE_FINITE // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined #undef HAVE_FINITE // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined
#endif #endif
#include "Python.h" #include "Python.h"
// SMESH includes // SMESH includes
#include "SMESHGUI.h" #include "SMESHGUI.h"
#include "SMESHGUI_Add0DElemsOnAllNodesDlg.h"
#include "SMESHGUI_AddMeshElementDlg.h" #include "SMESHGUI_AddMeshElementDlg.h"
#include "SMESHGUI_AddQuadraticElementDlg.h" #include "SMESHGUI_AddQuadraticElementDlg.h"
#include "SMESHGUI_BuildCompoundDlg.h" #include "SMESHGUI_BuildCompoundDlg.h"
#include "SMESHGUI_ClippingDlg.h" #include "SMESHGUI_ClippingDlg.h"
#include "SMESHGUI_ComputeDlg.h" #include "SMESHGUI_ComputeDlg.h"
#include "SMESHGUI_ConvToQuadOp.h" #include "SMESHGUI_ConvToQuadOp.h"
#include "SMESHGUI_CopyMeshDlg.h"
#include "SMESHGUI_CreatePolyhedralVolumeDlg.h" #include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
#include "SMESHGUI_DeleteGroupDlg.h" #include "SMESHGUI_DeleteGroupDlg.h"
#include "SMESHGUI_Displayer.h" #include "SMESHGUI_Displayer.h"
#include "SMESHGUI_MergeDlg.h" #include "SMESHGUI_DuplicateNodesDlg.h"
#include "SMESHGUI_ExtrusionAlongPathDlg.h" #include "SMESHGUI_ExtrusionAlongPathDlg.h"
#include "SMESHGUI_ExtrusionDlg.h" #include "SMESHGUI_ExtrusionDlg.h"
#include "SMESHGUI_FileInfoDlg.h" #include "SMESHGUI_FileInfoDlg.h"
@ -53,6 +56,7 @@
#include "SMESHGUI_Make2DFrom3DOp.h" #include "SMESHGUI_Make2DFrom3DOp.h"
#include "SMESHGUI_MakeNodeAtPointDlg.h" #include "SMESHGUI_MakeNodeAtPointDlg.h"
#include "SMESHGUI_Measurements.h" #include "SMESHGUI_Measurements.h"
#include "SMESHGUI_MergeDlg.h"
#include "SMESHGUI_MeshInfo.h" #include "SMESHGUI_MeshInfo.h"
#include "SMESHGUI_MeshOp.h" #include "SMESHGUI_MeshOp.h"
#include "SMESHGUI_MeshOrderOp.h" #include "SMESHGUI_MeshOrderOp.h"
@ -64,61 +68,59 @@
#include "SMESHGUI_RemoveElementsDlg.h" #include "SMESHGUI_RemoveElementsDlg.h"
#include "SMESHGUI_RemoveNodesDlg.h" #include "SMESHGUI_RemoveNodesDlg.h"
#include "SMESHGUI_RenumberingDlg.h" #include "SMESHGUI_RenumberingDlg.h"
#include "SMESHGUI_ReorientFacesDlg.h"
#include "SMESHGUI_RevolutionDlg.h" #include "SMESHGUI_RevolutionDlg.h"
#include "SMESHGUI_RotationDlg.h" #include "SMESHGUI_RotationDlg.h"
#include "SMESHGUI_ScaleDlg.h"
#include "SMESHGUI_Selection.h" #include "SMESHGUI_Selection.h"
#include "SMESHGUI_SewingDlg.h" #include "SMESHGUI_SewingDlg.h"
#include "SMESHGUI_SingleEditDlg.h" #include "SMESHGUI_SingleEditDlg.h"
#include "SMESHGUI_SmoothingDlg.h" #include "SMESHGUI_SmoothingDlg.h"
#include "SMESHGUI_SymmetryDlg.h" #include "SMESHGUI_SymmetryDlg.h"
#include "SMESHGUI_TranslationDlg.h" #include "SMESHGUI_TranslationDlg.h"
#include "SMESHGUI_ScaleDlg.h"
#include "SMESHGUI_TransparencyDlg.h" #include "SMESHGUI_TransparencyDlg.h"
#include "SMESHGUI_DuplicateNodesDlg.h"
#include "SMESHGUI_CopyMeshDlg.h"
#include "SMESHGUI_ReorientFacesDlg.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_GroupUtils.h"
#include "SMESHGUI_FilterUtils.h" #include "SMESHGUI_FilterUtils.h"
#include "SMESHGUI_PatternUtils.h" #include "SMESHGUI_GroupUtils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_HypothesesUtils.h" #include "SMESHGUI_HypothesesUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_PatternUtils.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include <SMESH_version.h> #include <SMESH_version.h>
#include <SMESH_Client.hxx>
#include <SMESH_Actor.h>
#include <SMESH_ScalarBarActor.h>
#include <SMESH_ActorUtils.h>
#include <SMESH_TypeFilter.hxx>
#include "SMESH_ControlsDef.hxx" #include "SMESH_ControlsDef.hxx"
#include <SMESH_Actor.h>
#include <SMESH_ActorUtils.h>
#include <SMESH_Client.hxx>
#include <SMESH_ScalarBarActor.h>
#include <SMESH_TypeFilter.hxx>
// SALOME GUI includes // SALOME GUI includes
#include <SalomeApp_Tools.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Application.h> #include <SalomeApp_Application.h>
#include <SalomeApp_CheckFileDlg.h> #include <SalomeApp_CheckFileDlg.h>
#include <SalomeApp_DataObject.h> #include <SalomeApp_DataObject.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Tools.h>
#include <LightApp_DataOwner.h> #include <LightApp_DataOwner.h>
#include <LightApp_NameDlg.h>
#include <LightApp_Preferences.h> #include <LightApp_Preferences.h>
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
#include <LightApp_UpdateFlags.h> #include <LightApp_UpdateFlags.h>
#include <LightApp_NameDlg.h>
#include <SVTK_ViewWindow.h>
#include <SVTK_ViewModel.h>
#include <SVTK_ViewManager.h> #include <SVTK_ViewManager.h>
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <VTKViewer_Algorithm.h> #include <VTKViewer_Algorithm.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_FileDlg.h>
#include <SUIT_Desktop.h> #include <SUIT_Desktop.h>
#include <SUIT_FileDlg.h>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h> #include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h> #include <SUIT_Session.h>
#include <QtxPopupMgr.h> #include <QtxPopupMgr.h>
@ -148,18 +150,18 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
// VTK includes // VTK includes
#include <vtkCamera.h>
#include <vtkRenderer.h>
#include <vtkPlane.h>
#include <vtkCallbackCommand.h> #include <vtkCallbackCommand.h>
#include <vtkCamera.h>
#include <vtkLookupTable.h> #include <vtkLookupTable.h>
#include <vtkPlane.h>
#include <vtkRenderer.h>
// SALOME KERNEL includes // SALOME KERNEL includes
#include <SALOMEDS_Study.hxx>
#include <SALOMEDSClient_StudyBuilder.hxx>
#include <SALOMEDSClient_SComponent.hxx>
#include <SALOMEDSClient_ClientFactory.hxx> #include <SALOMEDSClient_ClientFactory.hxx>
#include <SALOMEDSClient_IParameters.hxx> #include <SALOMEDSClient_IParameters.hxx>
#include <SALOMEDSClient_SComponent.hxx>
#include <SALOMEDSClient_StudyBuilder.hxx>
#include <SALOMEDS_Study.hxx>
// OCCT includes // OCCT includes
#include <Standard_ErrorHandler.hxx> #include <Standard_ErrorHandler.hxx>
@ -168,7 +170,8 @@
#include <Basics_Utils.hxx> #include <Basics_Utils.hxx>
//To disable automatic genericobj management, the following line should be commented. //To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx //Otherwise, it should be uncommented.
//Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ #define WITHGENERICOBJ
//namespace{ //namespace{
@ -223,10 +226,28 @@
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
anInitialPath = QDir::currentPath(); anInitialPath = QDir::currentPath();
QStringList filenames = SUIT_FileDlg::getOpenFileNames( SMESHGUI::desktop(), QStringList filenames;
anInitialPath, bool toCreateGroups = true;
filter,
QObject::tr( "SMESH_IMPORT_MESH" ) ); // if ( theCommandID == 118 ) { // GMF
// SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
// ( SMESHGUI::desktop(), true, QObject::tr("SMESH_REQUIRED_GROUPS"), true, true );
// fd->setWindowTitle( QObject::tr( "SMESH_IMPORT_MESH" ) );
// fd->setNameFilters( filter );
// fd->SetChecked( true );
// if ( fd->exec() )
// filenames << fd->selectedFile();
// toCreateGroups = fd->IsChecked();
// delete fd;
// }
// else
{
filenames = SUIT_FileDlg::getOpenFileNames( SMESHGUI::desktop(),
anInitialPath,
filter,
QObject::tr( "SMESH_IMPORT_MESH" ) );
}
if ( filenames.count() > 0 ) { if ( filenames.count() > 0 ) {
SUIT_OverrideCursor wc; SUIT_OverrideCursor wc;
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
@ -305,7 +326,9 @@
// GMF format // GMF format
SMESH::ComputeError_var res; SMESH::ComputeError_var res;
aMeshes->length( 1 ); aMeshes->length( 1 );
aMeshes[0] = theComponentMesh->CreateMeshesFromGMF( filename.toLatin1().constData(), res.out() ); aMeshes[0] = theComponentMesh->CreateMeshesFromGMF( filename.toLatin1().constData(),
toCreateGroups,
res.out() );
if ( res->code != SMESH::DRS_OK ) { if ( res->code != SMESH::DRS_OK ) {
errors.append( QString( "%1 :\n\t%2" ).arg( filename ). errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res->code ).toLatin1().data() ) ) ); arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res->code ).toLatin1().data() ) ) );
@ -595,11 +618,37 @@
else if ( isGMF ) else if ( isGMF )
aFilter = QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)" + aFilter = QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)" +
";;" + QObject::tr( "GMF_BINARY_FILES_FILTER" ) + " (*.meshb)"; ";;" + QObject::tr( "GMF_BINARY_FILES_FILTER" ) + " (*.meshb)";
if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath(); if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(),
anInitialPath + QString("/") + aMeshName, anInitialPath + QString("/") + aMeshName,
aFilter, aTitle, false); aFilter, aTitle, false);
} }
// else if ( isGMF )// Export to GMF
// {
// SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
// ( SMESHGUI::desktop(), false, QObject::tr("SMESH_REQUIRED_GROUPS"), true, true );
// QStringList filters;
// filters << QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)"
// << QObject::tr( "GMF_BINARY_FILES_FILTER" ) + " (*.meshb)";
// fd->setWindowTitle( aTitle );
// fd->setNameFilters( filters );
// if ( !aMeshOrGroup->_is_equivalent( aMesh ))
// toCreateGroups = false;
// else
// toCreateGroups = ( aMesh->NbGroups() > 0 );
// fd->SetChecked( true );
// if ( !anInitialPath.isEmpty() )
// fd->setDirectory( anInitialPath );
// fd->selectFile(aMeshName);
// if ( fd->exec() )
// aFilename = fd->selectedFile();
// toCreateGroups = fd->IsChecked();
// delete fd;
// }
else if ( isCGNS )// Export to CGNS else if ( isCGNS )// Export to CGNS
{ {
SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true ); SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
@ -845,7 +894,8 @@
} }
else if ( isGMF ) else if ( isGMF )
{ {
aMesh->ExportGMF( aMeshOrGroup, aFilename.toLatin1().data() ); toCreateGroups = true;
aMesh->ExportGMF( aMeshOrGroup, aFilename.toLatin1().data(), toCreateGroups );
} }
} }
catch (const SALOME::SALOME_Exception& S_ex){ catch (const SALOME::SALOME_Exception& S_ex){
@ -3020,7 +3070,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if(checkLock(aStudy)) break; if(checkLock(aStudy)) break;
if ( vtkwnd ) { if ( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SMDSAbs_EntityType type; SMDSAbs_EntityType type = SMDSEntity_Last;
switch (theCommandID) { switch (theCommandID) {
case 4034: case 4034:
@ -3038,13 +3088,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case 4039: case 4039:
type = SMDSEntity_Quad_Penta; break; type = SMDSEntity_Quad_Penta; break;
case 4040: case 4040:
type = SMDSEntity_Quad_Hexa; type = SMDSEntity_Quad_Hexa; break;
case 4140: case 4140:
type = SMDSEntity_TriQuad_Hexa; type = SMDSEntity_TriQuad_Hexa; break;
break; default: break;
default:;
} }
( new SMESHGUI_AddQuadraticElementDlg( this, type ) )->show(); if ( type != SMDSEntity_Last )
( new SMESHGUI_AddQuadraticElementDlg( this, type ) )->show();
} }
else { else {
SUIT_MessageBox::warning(SMESHGUI::desktop(), SUIT_MessageBox::warning(SMESHGUI::desktop(),
@ -3295,6 +3345,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break; break;
} }
case 4070: // 0D_ON_ALL_NODES
startOperation( 4070 );
break;
case 5105: // Library of selection filters case 5105: // Library of selection filters
{ {
static QList<int> aTypes; static QList<int> aTypes;
@ -3645,6 +3699,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 4067, "MESH_THROU_POINT","ICON_DLG_MOVE_NODE" ); createSMESHAction( 4067, "MESH_THROU_POINT","ICON_DLG_MOVE_NODE" );
createSMESHAction( 4068, "SCALE", "ICON_DLG_MESH_SCALE" ); createSMESHAction( 4068, "SCALE", "ICON_DLG_MESH_SCALE" );
createSMESHAction( 4069, "DUPLICATE_NODES", "ICON_SMESH_DUPLICATE_NODES" ); createSMESHAction( 4069, "DUPLICATE_NODES", "ICON_SMESH_DUPLICATE_NODES" );
createSMESHAction( 4070, "0D_ON_ALL_NODES", "ICON_0D_ON_ALL_NODES" );
createSMESHAction( 407, "INV", "ICON_DLG_MESH_DIAGONAL" ); createSMESHAction( 407, "INV", "ICON_DLG_MESH_DIAGONAL" );
createSMESHAction( 408, "UNION2", "ICON_UNION2TRI" ); createSMESHAction( 408, "UNION2", "ICON_UNION2TRI" );
createSMESHAction( 409, "ORIENT", "ICON_DLG_MESH_ORIENTATION" ); createSMESHAction( 409, "ORIENT", "ICON_DLG_MESH_ORIENTATION" );
@ -3807,6 +3862,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 4000, addId, -1 ); createMenu( 4000, addId, -1 );
createMenu( 4009, addId, -1 ); createMenu( 4009, addId, -1 );
createMenu( 4070, addId, -1 );
createMenu( 4008, addId, -1 ); createMenu( 4008, addId, -1 );
createMenu( 4010, addId, -1 ); createMenu( 4010, addId, -1 );
createMenu( 4021, addId, -1 ); createMenu( 4021, addId, -1 );
@ -3932,6 +3988,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( 4000, addRemTb ); createTool( 4000, addRemTb );
createTool( 4009, addRemTb ); createTool( 4009, addRemTb );
createTool( 4070, addRemTb );
createTool( 4008, addRemTb ); createTool( 4008, addRemTb );
createTool( 4010, addRemTb ); createTool( 4010, addRemTb );
createTool( 4021, addRemTb ); createTool( 4021, addRemTb );
@ -5130,9 +5187,12 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const
case 904: // Find element case 904: // Find element
op = new SMESHGUI_FindElemByPointOp(); op = new SMESHGUI_FindElemByPointOp();
break; break;
case 4067: // make mesh pass through point case 4067: // Make mesh pass through point
op = new SMESHGUI_MakeNodeAtPointOp(); op = new SMESHGUI_MakeNodeAtPointOp();
break; break;
case 4070: // Create 0D elements on all nodes
op = new SMESHGUI_Add0DElemsOnAllNodesOp();
break;
default: default:
break; break;
} }
@ -5372,8 +5432,8 @@ void SMESHGUI::storeVisualParameters (int savePoint)
bool isE = aMode & SMESH_Actor::eEdges; bool isE = aMode & SMESH_Actor::eEdges;
bool isF = aMode & SMESH_Actor::eFaces; bool isF = aMode & SMESH_Actor::eFaces;
bool isV = aMode & SMESH_Actor::eVolumes; bool isV = aMode & SMESH_Actor::eVolumes;
bool is0d = aMode & SMESH_Actor::e0DElements; bool is0d = aMode & SMESH_Actor::e0DElements;
bool isB = aMode & SMESH_Actor::eBallElem; bool isB = aMode & SMESH_Actor::eBallElem;
QString modeStr ("e"); QString modeStr ("e");
modeStr += gDigitsSep; modeStr += QString::number(isE); modeStr += gDigitsSep; modeStr += QString::number(isE);
@ -5395,7 +5455,7 @@ void SMESHGUI::storeVisualParameters (int savePoint)
aSmeshActor->GetSufaceColor(r, g, b, delta); aSmeshActor->GetSufaceColor(r, g, b, delta);
QStringList colorStr; QStringList colorStr;
colorStr << "surface"; colorStr << "surface";
colorStr << QString::number(r); colorStr << QString::number(r);
colorStr << QString::number(g); colorStr << QString::number(g);
colorStr << QString::number(b); colorStr << QString::number(b);
@ -5450,8 +5510,8 @@ void SMESHGUI::storeVisualParameters (int savePoint)
ip->setParameter(entry, param, qPrintable(colorStr.join(gDigitsSep))); ip->setParameter(entry, param, qPrintable(colorStr.join(gDigitsSep)));
// Sizes // Sizes
QStringList sizeStr; QStringList sizeStr;
sizeStr << "line"; sizeStr << "line";
sizeStr << QString::number((int)aSmeshActor->GetLineWidth()); sizeStr << QString::number((int)aSmeshActor->GetLineWidth());
sizeStr << "outline"; sizeStr << "outline";
sizeStr << QString::number((int)aSmeshActor->GetOutlineWidth()); sizeStr << QString::number((int)aSmeshActor->GetOutlineWidth());
@ -5791,280 +5851,280 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
// Displayed entities // Displayed entities
else if (paramNameStr == "Entities") { else if (paramNameStr == "Entities") {
QStringList mode = val.split(gDigitsSep, QString::SkipEmptyParts); QStringList mode = val.split(gDigitsSep, QString::SkipEmptyParts);
int aEntityMode = SMESH_Actor::eAllEntity; int aEntityMode = SMESH_Actor::eAllEntity;
for ( int i = 0; i < mode.count(); i+=2 ) { for ( int i = 0; i < mode.count(); i+=2 ) {
if ( i < mode.count()-1 ) { if ( i < mode.count()-1 ) {
QString type = mode[i]; QString type = mode[i];
bool val = mode[i+1].toInt(); bool val = mode[i+1].toInt();
if ( type == "e" && !val ) if ( type == "e" && !val )
aEntityMode = aEntityMode & ~SMESH_Actor::eEdges; aEntityMode = aEntityMode & ~SMESH_Actor::eEdges;
else if ( type == "f" && !val ) else if ( type == "f" && !val )
aEntityMode = aEntityMode & ~SMESH_Actor::eFaces; aEntityMode = aEntityMode & ~SMESH_Actor::eFaces;
else if ( type == "v" && !val ) else if ( type == "v" && !val )
aEntityMode = aEntityMode & ~SMESH_Actor::eVolumes; aEntityMode = aEntityMode & ~SMESH_Actor::eVolumes;
else if ( type == "0d" && !val ) else if ( type == "0d" && !val )
aEntityMode = aEntityMode & ~SMESH_Actor::e0DElements; aEntityMode = aEntityMode & ~SMESH_Actor::e0DElements;
else if ( type == "b" && !val ) else if ( type == "b" && !val )
aEntityMode = aEntityMode & ~SMESH_Actor::eBallElem; aEntityMode = aEntityMode & ~SMESH_Actor::eBallElem;
} }
} }
aSmeshActor->SetEntityMode( aEntityMode ); aSmeshActor->SetEntityMode( aEntityMode );
} }
// Colors // Colors
else if (paramNameStr == "Colors") { else if (paramNameStr == "Colors") {
QStringList colors = val.split(gDigitsSep, QString::SkipEmptyParts); QStringList colors = val.split(gDigitsSep, QString::SkipEmptyParts);
QColor nodeColor; QColor nodeColor;
QColor edgeColor; QColor edgeColor;
QColor faceColor; QColor faceColor;
QColor volumeColor; QColor volumeColor;
QColor elem0dColor; QColor elem0dColor;
QColor ballColor; QColor ballColor;
QColor outlineColor; QColor outlineColor;
QColor orientationColor; QColor orientationColor;
int deltaF; int deltaF;
int deltaV; int deltaV;
QColor c; QColor c;
double r, g, b; double r, g, b;
bool bOk; bool bOk;
// below lines are required to get default values for delta coefficients // below lines are required to get default values for delta coefficients
// of backface color for faces and color of reversed volumes // of backface color for faces and color of reversed volumes
SMESH::GetColor( "SMESH", "fill_color", c, deltaF, "0,170,255|-100" ); SMESH::GetColor( "SMESH", "fill_color", c, deltaF, "0,170,255|-100" );
SMESH::GetColor( "SMESH", "volume_color", c, deltaV, "255,0,170|-100" ); SMESH::GetColor( "SMESH", "volume_color", c, deltaV, "255,0,170|-100" );
for ( int i = 0; i < colors.count(); i++ ) { for ( int i = 0; i < colors.count(); i++ ) {
QString type = colors[i]; QString type = colors[i];
if ( type == "surface" ) { if ( type == "surface" ) {
// face color is set by 3 values r:g:b, where // face color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components // - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
faceColor.setRgbF( r, g, b ); faceColor.setRgbF( r, g, b );
i += 3; i += 3;
} }
else if ( type == "backsurface" ) { else if ( type == "backsurface" ) {
// backface color can be defined in several ways // backface color can be defined in several ways
// - in old versions, it is set as rgb triple r:g:b - this was is unsupported now // - in old versions, it is set as rgb triple r:g:b - this was is unsupported now
// - in latest versions, it is set as delta coefficient // - in latest versions, it is set as delta coefficient
bool rgbOk = false, deltaOk; bool rgbOk = false, deltaOk;
if ( i+1 >= colors.count() ) break; // format error if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
int delta = colors[i+1].toInt( &deltaOk ); int delta = colors[i+1].toInt( &deltaOk );
i++; // shift index i++; // shift index
if ( i+1 < colors.count() ) // index is shifted to 1 if ( i+1 < colors.count() ) // index is shifted to 1
g = colors[i+1].toDouble( &rgbOk ); g = colors[i+1].toDouble( &rgbOk );
if ( rgbOk ) i++; // shift index if ( rgbOk ) i++; // shift index
if ( rgbOk && i+1 < colors.count() ) // index is shifted to 2 if ( rgbOk && i+1 < colors.count() ) // index is shifted to 2
b = colors[i+1].toDouble( &rgbOk ); b = colors[i+1].toDouble( &rgbOk );
if ( rgbOk ) i++; if ( rgbOk ) i++;
// - as currently there's no way to set directly backsurface color as it was before, // - as currently there's no way to set directly backsurface color as it was before,
// we ignore old dump where r,g,b triple was set // we ignore old dump where r,g,b triple was set
// - also we check that delta parameter is set properly // - also we check that delta parameter is set properly
if ( !rgbOk && deltaOk ) if ( !rgbOk && deltaOk )
deltaF = delta; deltaF = delta;
} }
else if ( type == "volume" ) { else if ( type == "volume" ) {
// volume color is set by 4 values r:g:b:delta, where // volume color is set by 4 values r:g:b:delta, where
// - r,g,b - is a normal volume rgb color components // - r,g,b - is a normal volume rgb color components
// - delta - is a reversed volume color delta coefficient // - delta - is a reversed volume color delta coefficient
if ( i+1 >= colors.count() ) break; // format error if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+4 >= colors.count() ) break; // format error if ( i+4 >= colors.count() ) break; // format error
int delta = colors[i+4].toInt( &bOk ); int delta = colors[i+4].toInt( &bOk );
if ( !bOk ) break; // format error if ( !bOk ) break; // format error
volumeColor.setRgbF( r, g, b ); volumeColor.setRgbF( r, g, b );
deltaV = delta; deltaV = delta;
i += 4; i += 4;
} }
else if ( type == "edge" ) { else if ( type == "edge" ) {
// edge color is set by 3 values r:g:b, where // edge color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components // - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
edgeColor.setRgbF( r, g, b ); edgeColor.setRgbF( r, g, b );
i += 3; i += 3;
} }
else if ( type == "node" ) { else if ( type == "node" ) {
// node color is set by 3 values r:g:b, where // node color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components // - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
nodeColor.setRgbF( r, g, b ); nodeColor.setRgbF( r, g, b );
i += 3; i += 3;
} }
else if ( type == "elem0d" ) { else if ( type == "elem0d" ) {
// 0d element color is set by 3 values r:g:b, where // 0d element color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components // - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
elem0dColor.setRgbF( r, g, b ); elem0dColor.setRgbF( r, g, b );
i += 3; i += 3;
} }
else if ( type == "ball" ) { else if ( type == "ball" ) {
// ball color is set by 3 values r:g:b, where // ball color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components // - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
ballColor.setRgbF( r, g, b ); ballColor.setRgbF( r, g, b );
i += 3; i += 3;
} }
else if ( type == "outline" ) { else if ( type == "outline" ) {
// outline color is set by 3 values r:g:b, where // outline color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components // - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
outlineColor.setRgbF( r, g, b ); outlineColor.setRgbF( r, g, b );
i += 3; i += 3;
} }
else if ( type == "orientation" ) { else if ( type == "orientation" ) {
// orientation color is set by 3 values r:g:b, where // orientation color is set by 3 values r:g:b, where
// - r,g,b - is rgb color components // - r,g,b - is rgb color components
if ( i+1 >= colors.count() ) break; // format error if ( i+1 >= colors.count() ) break; // format error
r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error r = colors[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= colors.count() ) break; // format error if ( i+2 >= colors.count() ) break; // format error
g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error g = colors[i+2].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+3 >= colors.count() ) break; // format error if ( i+3 >= colors.count() ) break; // format error
b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error b = colors[i+3].toDouble( &bOk ); if ( !bOk ) break; // format error
orientationColor.setRgbF( r, g, b ); orientationColor.setRgbF( r, g, b );
i += 3; i += 3;
} }
} }
// node color // node color
if ( nodeColor.isValid() ) if ( nodeColor.isValid() )
aSmeshActor->SetNodeColor( nodeColor.redF(), nodeColor.greenF(), nodeColor.blueF() ); aSmeshActor->SetNodeColor( nodeColor.redF(), nodeColor.greenF(), nodeColor.blueF() );
// edge color // edge color
if ( edgeColor.isValid() ) if ( edgeColor.isValid() )
aSmeshActor->SetEdgeColor( edgeColor.redF(), edgeColor.greenF(), edgeColor.blueF() ); aSmeshActor->SetEdgeColor( edgeColor.redF(), edgeColor.greenF(), edgeColor.blueF() );
// face color // face color
if ( faceColor.isValid() ) if ( faceColor.isValid() )
aSmeshActor->SetSufaceColor( faceColor.redF(), faceColor.greenF(), faceColor.blueF(), deltaF ); aSmeshActor->SetSufaceColor( faceColor.redF(), faceColor.greenF(), faceColor.blueF(), deltaF );
// volume color // volume color
if ( volumeColor.isValid() ) if ( volumeColor.isValid() )
aSmeshActor->SetVolumeColor( volumeColor.redF(), volumeColor.greenF(), volumeColor.blueF(), deltaV ); aSmeshActor->SetVolumeColor( volumeColor.redF(), volumeColor.greenF(), volumeColor.blueF(), deltaV );
else if ( faceColor.isValid() ) // backward compatibility (no separate color for volumes) else if ( faceColor.isValid() ) // backward compatibility (no separate color for volumes)
aSmeshActor->SetVolumeColor( faceColor.redF(), faceColor.greenF(), faceColor.blueF(), deltaF ); aSmeshActor->SetVolumeColor( faceColor.redF(), faceColor.greenF(), faceColor.blueF(), deltaF );
// 0d element color // 0d element color
if ( elem0dColor.isValid() ) if ( elem0dColor.isValid() )
aSmeshActor->Set0DColor( elem0dColor.redF(), elem0dColor.greenF(), elem0dColor.blueF() ); aSmeshActor->Set0DColor( elem0dColor.redF(), elem0dColor.greenF(), elem0dColor.blueF() );
// ball color // ball color
if ( ballColor.isValid() ) if ( ballColor.isValid() )
aSmeshActor->SetBallColor( ballColor.redF(), ballColor.greenF(), ballColor.blueF() ); aSmeshActor->SetBallColor( ballColor.redF(), ballColor.greenF(), ballColor.blueF() );
// outline color // outline color
if ( outlineColor.isValid() ) if ( outlineColor.isValid() )
aSmeshActor->SetOutlineColor( outlineColor.redF(), outlineColor.greenF(), outlineColor.blueF() ); aSmeshActor->SetOutlineColor( outlineColor.redF(), outlineColor.greenF(), outlineColor.blueF() );
// orientation color // orientation color
if ( orientationColor.isValid() ) if ( orientationColor.isValid() )
aSmeshActor->SetFacesOrientationColor( orientationColor.redF(), orientationColor.greenF(), orientationColor.blueF() ); aSmeshActor->SetFacesOrientationColor( orientationColor.redF(), orientationColor.greenF(), orientationColor.blueF() );
} }
// Sizes // Sizes
else if (paramNameStr == "Sizes") { else if (paramNameStr == "Sizes") {
QStringList sizes = val.split(gDigitsSep, QString::SkipEmptyParts); QStringList sizes = val.split(gDigitsSep, QString::SkipEmptyParts);
bool bOk; bool bOk;
int lineWidth = -1; int lineWidth = -1;
int outlineWidth = -1; int outlineWidth = -1;
int elem0dSize = -1; int elem0dSize = -1;
int ballSize = -1; int ballSize = -1;
double shrinkSize = -1; double shrinkSize = -1;
double orientationSize = -1; double orientationSize = -1;
bool orientation3d = false; bool orientation3d = false;
for ( int i = 0; i < sizes.count(); i++ ) { for ( int i = 0; i < sizes.count(); i++ ) {
QString type = sizes[i]; QString type = sizes[i];
if ( type == "line" ) { if ( type == "line" ) {
// line (wireframe) width is given as single integer value // line (wireframe) width is given as single integer value
if ( i+1 >= sizes.count() ) break; // format error if ( i+1 >= sizes.count() ) break; // format error
int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error
lineWidth = v; lineWidth = v;
i++; i++;
} }
if ( type == "outline" ) { if ( type == "outline" ) {
// outline width is given as single integer value // outline width is given as single integer value
if ( i+1 >= sizes.count() ) break; // format error if ( i+1 >= sizes.count() ) break; // format error
int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error
outlineWidth = v; outlineWidth = v;
i++; i++;
} }
else if ( type == "elem0d" ) { else if ( type == "elem0d" ) {
// 0d element size is given as single integer value // 0d element size is given as single integer value
if ( i+1 >= sizes.count() ) break; // format error if ( i+1 >= sizes.count() ) break; // format error
int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error
elem0dSize = v; elem0dSize = v;
i++; i++;
} }
else if ( type == "ball" ) { else if ( type == "ball" ) {
// ball size is given as single integer value // ball size is given as single integer value
if ( i+1 >= sizes.count() ) break; // format error if ( i+1 >= sizes.count() ) break; // format error
int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error int v = sizes[i+1].toInt( &bOk ); if ( !bOk ) break; // format error
ballSize = v; ballSize = v;
i++; i++;
} }
else if ( type == "shrink" ) { else if ( type == "shrink" ) {
// shrink factor is given as single floating point value // shrink factor is given as single floating point value
if ( i+1 >= sizes.count() ) break; // format error if ( i+1 >= sizes.count() ) break; // format error
double v = sizes[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error double v = sizes[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
shrinkSize = v; shrinkSize = v;
i++; i++;
} }
else if ( type == "orientation" ) { else if ( type == "orientation" ) {
// orientation vectors are specified by two values size:3d, where // orientation vectors are specified by two values size:3d, where
// - size - is a floating point value specifying scale factor // - size - is a floating point value specifying scale factor
// - 3d - is a boolean // - 3d - is a boolean
if ( i+1 >= sizes.count() ) break; // format error if ( i+1 >= sizes.count() ) break; // format error
double v1 = sizes[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error double v1 = sizes[i+1].toDouble( &bOk ); if ( !bOk ) break; // format error
if ( i+2 >= sizes.count() ) break; // format error if ( i+2 >= sizes.count() ) break; // format error
int v2 = sizes[i+2].toInt( &bOk ); if ( !bOk ) break; // format error int v2 = sizes[i+2].toInt( &bOk ); if ( !bOk ) break; // format error
orientationSize = v1; orientationSize = v1;
orientation3d = (bool)v2; orientation3d = (bool)v2;
i += 2; i += 2;
} }
} }
// line (wireframe) width // line (wireframe) width
if ( lineWidth > 0 ) if ( lineWidth > 0 )
aSmeshActor->SetLineWidth( lineWidth ); aSmeshActor->SetLineWidth( lineWidth );
// outline width // outline width
if ( outlineWidth > 0 ) if ( outlineWidth > 0 )
aSmeshActor->SetOutlineWidth( outlineWidth ); aSmeshActor->SetOutlineWidth( outlineWidth );
else if ( lineWidth > 0 ) // backward compatibility (no separate width for outlines) else if ( lineWidth > 0 ) // backward compatibility (no separate width for outlines)
aSmeshActor->SetOutlineWidth( lineWidth ); aSmeshActor->SetOutlineWidth( lineWidth );
// 0d element size // 0d element size
if ( elem0dSize > 0 ) if ( elem0dSize > 0 )
aSmeshActor->Set0DSize( elem0dSize ); aSmeshActor->Set0DSize( elem0dSize );
// ball size // ball size
if ( ballSize > 0 ) if ( ballSize > 0 )
aSmeshActor->SetBallSize( ballSize ); aSmeshActor->SetBallSize( ballSize );
// shrink factor // shrink factor
if ( shrinkSize > 0 ) if ( shrinkSize > 0 )
aSmeshActor->SetShrinkFactor( shrinkSize ); aSmeshActor->SetShrinkFactor( shrinkSize );
// orientation vectors // orientation vectors
if ( orientationSize > 0 ) { if ( orientationSize > 0 ) {
aSmeshActor->SetFacesOrientationScale( orientationSize ); aSmeshActor->SetFacesOrientationScale( orientationSize );
aSmeshActor->SetFacesOrientation3DVectors( orientation3d ); aSmeshActor->SetFacesOrientation3DVectors( orientation3d );
} }
} }
// Point marker // Point marker
else if (paramNameStr == "PointMarker") { else if (paramNameStr == "PointMarker") {

View File

@ -0,0 +1,495 @@
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_Add0DElemsOnAllNodesDlg.cxx
// Created : Fri Oct 19 15:51:24 2012
// Author : Edward AGAPOV (eap)
#include "SMESHGUI_Add0DElemsOnAllNodesDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_FilterDlg.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESH_LogicalFilter.hxx"
#include "SMESH_TypeFilter.hxx"
#include <LightApp_SelectionMgr.h>
#include <SALOME_ListIO.hxx>
#include <SUIT_MessageBox.h>
#include <SVTK_Selector.h>
#include <SalomeApp_Tools.h>
// Qt includes
#include <QButtonGroup>
#include <QCheckBox>
#include <QComboBox>
#include <QFrame>
#include <QGridLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QRadioButton>
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
#define SPACING 6
#define MARGIN 11
enum { SEL_OBJECT, SEL_ELEMENTS, SEL_NODES };
//================================================================================
/*!
* \brief Dialog Constructor
*/
//================================================================================
SMESHGUI_Add0DElemsOnAllNodesDlg::SMESHGUI_Add0DElemsOnAllNodesDlg()
: SMESHGUI_Dialog( 0, false, true ),
myIDValidator( this )
{
setWindowTitle( tr( "CAPTION" ) );
// Seletction type radio buttons
QGroupBox* selTypeGrBox = new QGroupBox( mainFrame() );
//
QRadioButton* objBtn = new QRadioButton( tr( "SMESH_SUBMESH_GROUP"),selTypeGrBox );
QRadioButton* elemBtn = new QRadioButton( tr( "SMESH_ELEMENTS" ),selTypeGrBox );
QRadioButton* nodeBtn = new QRadioButton( tr( "SMESH_NODES" ),selTypeGrBox );
//
QHBoxLayout* selTypeLay = new QHBoxLayout( selTypeGrBox );
selTypeLay->setMargin(MARGIN);
selTypeLay->setSpacing(SPACING);
selTypeLay->addWidget( objBtn );
selTypeLay->addWidget( elemBtn );
selTypeLay->addWidget( nodeBtn );
objBtn->setChecked(true);
//
mySelTypeBtnGrp = new QButtonGroup( mainFrame() );
mySelTypeBtnGrp->addButton( objBtn , SEL_OBJECT );
mySelTypeBtnGrp->addButton( elemBtn, SEL_ELEMENTS );
mySelTypeBtnGrp->addButton( nodeBtn, SEL_NODES );
// Label, Select Btn, LineEdit, Filter Btn
setObjectPixmap( "SMESH", tr( "ICON_SELECT" ) );
createObject( tr( "SMESH_NAME" ), mainFrame(), 0 );
myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), mainFrame() );
// List of groups
myGroupBox = new QGroupBox( tr( "SMESH_ADD_TO_GROUP" ), mainFrame() );
myGroupBox->setCheckable( true );
myGroupLabel = new QLabel( tr( "SMESH_GROUP" ), myGroupBox );
myGroupListCmBox = new QComboBox( myGroupBox );
myGroupListCmBox->setEditable( true );
myGroupListCmBox->setInsertPolicy( QComboBox::NoInsert );
QHBoxLayout* groupsLayout = new QHBoxLayout( myGroupBox );
groupsLayout->setSpacing(SPACING);
groupsLayout->setMargin(MARGIN);
groupsLayout->addWidget( myGroupLabel );
groupsLayout->addWidget( myGroupListCmBox, 1 );
// Main layout
QGridLayout* aLay = new QGridLayout( mainFrame() );
aLay->setMargin(MARGIN);
aLay->setSpacing(SPACING);
//
aLay->addWidget( selTypeGrBox, 0, 0, 1, 5 );
//
aLay->addWidget( objectWg( 0, Label ), 1, 0 );
aLay->addWidget( objectWg( 0, Btn ), 1, 1 );
aLay->addWidget( objectWg( 0, Control), 1, 2, 1, 2 );
aLay->addWidget( myFilterBtn, 1, 4 );
//
aLay->addWidget( myGroupBox, 2, 0, 1, 5 );
// Signals
connect( myGroupBox, SIGNAL( toggled( bool )), SLOT( onGroupChecked() ));
connect( mySelTypeBtnGrp, SIGNAL( buttonClicked(int) ), SLOT( onSelTypeChange(int)));
onSelTypeChange( SEL_OBJECT );
}
//================================================================================
/*!
* \brief SLOT to enable/disable groups
*/
//================================================================================
void SMESHGUI_Add0DElemsOnAllNodesDlg::onGroupChecked( bool on )
{
myGroupLabel->setEnabled( on );
myGroupListCmBox->setEnabled( on );
}
//================================================================================
/*!
* \brief SLOT to enable/disable groups
*/
//================================================================================
void SMESHGUI_Add0DElemsOnAllNodesDlg::onSelTypeChange( int selType )
{
setNameIndication( 0, selType == SEL_OBJECT ? OneName : ListOfNames );
setReadOnly ( 0, selType == SEL_OBJECT );
QLabel* label = qobject_cast< QLabel* >( objectWg(0, Label ));
switch( selType ) {
case SEL_OBJECT: label->setText( tr("SMESH_NAME")); break;
case SEL_ELEMENTS: label->setText( tr("ELEMENT_IDS")); break;
case SEL_NODES: label->setText( tr("NODE_IDS")); break;
default:;
}
QLineEdit* lineEdit = qobject_cast< QLineEdit* >( objectWg(0, Control ));
lineEdit->setText("");
lineEdit->setValidator( selType == SEL_OBJECT ? 0 : & myIDValidator );
myFilterBtn->setEnabled( selType != SEL_OBJECT );
emit selTypeChanged( selType );
}
//================================================================================
/*!
* \brief Return type of selected object: [SEL_OBJECT, SEL_ELEMENTS, SEL_NODES]
*/
//================================================================================
int SMESHGUI_Add0DElemsOnAllNodesDlg::getSelectionType() const
{
return mySelTypeBtnGrp->checkedId();
}
//================================================================================
/*!
* \brief Checks consistency of data
*/
//================================================================================
bool SMESHGUI_Add0DElemsOnAllNodesDlg::isValid()
{
if( myGroupBox->isChecked() && myGroupListCmBox->currentText().isEmpty() ) {
SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ), tr( "GROUP_NAME_IS_EMPTY" ) );
return false;
}
return true;
}
//================================================================================
/*!
* \brief Operation Constructor
*/
//================================================================================
SMESHGUI_Add0DElemsOnAllNodesOp::SMESHGUI_Add0DElemsOnAllNodesOp()
:SMESHGUI_SelectionOp(),
myDlg( new SMESHGUI_Add0DElemsOnAllNodesDlg ),
myFilterDlg( 0 )
{
myHelpFileName = "adding_nodes_and_elements_page.html#adding_0delems_on_all_nodes_anchor";
connect( myDlg, SIGNAL( selTypeChanged(int) ), SLOT( onSelTypeChange(int)));
connect( myDlg->myFilterBtn, SIGNAL( clicked()), SLOT( onSetFilter() ));
}
//================================================================================
/*!
* \brief Destructor
*/
//================================================================================
SMESHGUI_Add0DElemsOnAllNodesOp::~SMESHGUI_Add0DElemsOnAllNodesOp()
{
if ( myFilterDlg ) {
myFilterDlg->setParent( 0 );
delete myFilterDlg;
myFilterDlg = 0;
}
}
//================================================================================
/*!
* \brief Start
*/
//================================================================================
void SMESHGUI_Add0DElemsOnAllNodesOp::startOperation()
{
SMESHGUI_SelectionOp::startOperation();
myDlg->myGroupBox->setChecked( false );
myDlg->activateObject( 0 );
myDlg->show();
selectionDone();
}
//================================================================================
/*!
* \brief Treat changed selection
*/
//================================================================================
void SMESHGUI_Add0DElemsOnAllNodesOp::selectionDone()
{
if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dgl active
if (!myDlg->myGroupBox->isEnabled()) return; // inactive
myIO.Nullify();
myDlg->setObjectText( 0, "");
SALOME_ListIO aList;
selectionMgr()->selectedObjects( aList );
if ( aList.Extent() == 1 )
myIO = aList.First();
else
return;
QString ids;
switch ( myDlg->getSelectionType() ) {
case SEL_OBJECT:
SMESHGUI_SelectionOp::selectionDone();
break;
case SEL_ELEMENTS:
SMESH::GetNameOfSelectedElements( selector(), myIO, ids );
myDlg->setObjectText( 0, ids );
break;
case SEL_NODES:
SMESH::GetNameOfSelectedNodes( selector(), myIO, ids );
myDlg->setObjectText( 0, ids );
break;
default:;
}
// fill the list of existing groups
myDlg->myGroupListCmBox->clear();
myDlg->myGroupListCmBox->addItem( QString() );
if ( !myIO.IsNull() && myIO->hasEntry()) {
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
_PTR(SObject) meshSO = aStudy->FindObjectID( myIO->getEntry() );
_PTR(SObject) group0DRoot;
if ( meshSO->FindSubObject( SMESH::Tag_0DElementsGroups, group0DRoot ))
{
_PTR(ChildIterator) group0DIter = aStudy->NewChildIterator( group0DRoot );
for ( ; group0DIter->More(); group0DIter->Next() )
{
_PTR(SObject) groupSO = group0DIter->Value();
std::string groupName = groupSO->GetName();
if ( !groupName.empty() )
myDlg->myGroupListCmBox->addItem( groupName.c_str() );
}
}
}
}
//================================================================================
/*!
* \brief Return a filter of objects
*/
//================================================================================
SUIT_SelectionFilter* SMESHGUI_Add0DElemsOnAllNodesOp::createFilter( const int ) const
{
if ( myDlg->getSelectionType() == SEL_OBJECT )
{
// Create a filter of objects: any IDSource except the group of 0D elements
QList<SUIT_SelectionFilter*> filters;
filters.push_back( new SMESH_TypeFilter( SMESH::GROUP_0D ));
SMESH_LogicalFilter* not0DGroup = new SMESH_LogicalFilter( filters,
SMESH_LogicalFilter::LO_NOT,
/*takeOwnership=*/true);
filters[0] = not0DGroup;
filters.push_back( new SMESH_TypeFilter( SMESH::IDSOURCE ));
return new SMESH_LogicalFilter( filters,
SMESH_LogicalFilter::LO_AND,
/*takeOwnership=*/true);
}
return 0;
}
//================================================================================
/*!
* \brief Makes its main job
*/
//================================================================================
bool SMESHGUI_Add0DElemsOnAllNodesOp::onApply()
{
if ( !myDlg->isValid() )
return false;
// get a mesh
SMESH::SMESH_IDSource_var meshObject;
SMESH::SMESH_Mesh_var mesh;
if ( !myIO.IsNull() )
{
CORBA::Object_var obj = SMESH::IObjectToObject( myIO );
meshObject = SMESH::SMESH_IDSource::_narrow( obj );
if ( !meshObject->_is_nil() )
mesh = meshObject->GetMesh();
}
if ( mesh->_is_nil() )
{
SUIT_MessageBox::warning( myDlg, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_BAD_SELECTION" ) );
return false;
}
try {
SMESH::SMESH_MeshEditor_var editor = mesh->GetMeshEditor();
// make SMESH_IDSource holding IDs of selected elements
if ( myDlg->getSelectionType() != SEL_OBJECT )
{
QString elemIDs = myDlg->objectText( 0 );
QStringList idList = elemIDs.split( " ", QString::SkipEmptyParts );
if ( idList.count() == 0 )
{
SUIT_MessageBox::warning( myDlg, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_BAD_SELECTION" ) );
return false;
}
SMESH::long_array_var idArray = new SMESH::long_array;
idArray->length( idList.count() );
QStringList::iterator idIt = idList.begin();
for ( int i = 0; idIt != idList.end(); ++idIt, ++i )
idArray[i] = idIt->toLong();
SMESH::ElementType elemType =
myDlg->getSelectionType() == SEL_NODES ? SMESH::NODE : SMESH::ALL;
meshObject = editor->MakeIDSource( idArray, elemType );
}
// Create 0D elements
int prevNb0D = mesh->Nb0DElements();
QString groupName = myDlg->myGroupListCmBox->currentText();
SMESH::SMESH_IDSource_var newObj =
editor->Create0DElementsOnAllNodes( meshObject, groupName.toLatin1().data() );
int newNb0D = mesh->Nb0DElements() - prevNb0D;
SUIT_MessageBox::information( myDlg, tr( "SMESH_INFORMATION" ),
tr( "NB_NEW_0D" ).arg( newNb0D ),
SUIT_MessageBox::Ok, SUIT_MessageBox::Ok);
}
catch ( const SALOME::SALOME_Exception& S_ex ) {
SalomeApp_Tools::QtCatchCorbaException( S_ex );
return false;
}
catch (...) {
return false;
}
// clear selection
if ( myDlg->getSelectionType() == SEL_OBJECT )
{
SALOME_ListIO aList;
selectionMgr()->setSelectedObjects( aList, /*append=*/false );
}
else
{
selector()->ClearIndex();
}
selectionDone();
SMESH::UpdateView();
SMESHGUI::Modified();
if ( myDlg->myGroupBox->isChecked() )
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
return true;
}
//================================================================================
/*!
* \brief Sets selection mode
*/
//================================================================================
void SMESHGUI_Add0DElemsOnAllNodesOp::onSelTypeChange(int selType)
{
switch ( selType ) {
case SEL_OBJECT: setSelectionMode( ActorSelection ); break;
case SEL_ELEMENTS: setSelectionMode( CellSelection ); break;
case SEL_NODES: setSelectionMode( NodeSelection ); break;
}
if ( selType != SEL_OBJECT )
connect( myDlg, SIGNAL( objectChanged( int, const QStringList& )),
this, SLOT ( onTextChanged( int, const QStringList& )));
else
disconnect( myDlg, SIGNAL( objectChanged( int, const QStringList& )),
this, SLOT ( onTextChanged( int, const QStringList& )));
selectionDone();
}
//================================================================================
/*!
* \brief Install
*
*
*/
//================================================================================
void SMESHGUI_Add0DElemsOnAllNodesOp::onSetFilter()
{
SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO( myIO );
if ( mesh->_is_nil()) {
SUIT_MessageBox::critical( myDlg, tr("SMESH_ERROR"), tr("NO_MESH_SELECTED"));
return;
}
QList<int> types;
if ( myDlg->getSelectionType() == SEL_NODES ) {
types.push_back( SMESH::NODE );
}
else if ( myDlg->getSelectionType() == SEL_ELEMENTS ) {
types.push_back( SMESH::EDGE );
types.push_back( SMESH::FACE );
types.push_back( SMESH::VOLUME );
}
else
return;
if ( !myFilterDlg )
myFilterDlg = new SMESHGUI_FilterDlg( getSMESHGUI(), SMESH::ALL );
myFilterDlg->Init( types );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( mesh );
myFilterDlg->SetSourceWg( myDlg->objectWg( 0, LightApp_Dialog::Control ));
myFilterDlg->show();
}

View File

@ -0,0 +1,110 @@
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
#ifndef SMESHGUI_ADD0DELEMSONALLNODESDLG_H
#define SMESHGUI_ADD0DELEMSONALLNODESDLG_H
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_SelectionOp.h"
#include "SMESHGUI_Dialog.h"
#include "SMESHGUI_IdValidator.h"
class SMESHGUI_FilterDlg;
class SMESHGUI_Add0DElemsOnAllNodesOp;
class QButtonGroup;
class QPushButton;
class QGroupBox;
class QLabel;
class QComboBox;
//---------------------------------------------------------------------------------
/*!
* \brief Dialog creating 0D elements on all nodes of given elements
*/
class SMESHGUI_EXPORT SMESHGUI_Add0DElemsOnAllNodesDlg : public SMESHGUI_Dialog
{
Q_OBJECT
public:
SMESHGUI_Add0DElemsOnAllNodesDlg();
int getSelectionType() const;
bool isValid();
signals:
void selTypeChanged( int selType );
private slots:
void onGroupChecked ( bool on );
void onSelTypeChange( int selType );
private:
friend class SMESHGUI_Add0DElemsOnAllNodesOp;
QButtonGroup* mySelTypeBtnGrp;
QPushButton* myFilterBtn;
QGroupBox* myGroupBox;
QLabel* myGroupLabel;
QComboBox* myGroupListCmBox;
SMESHGUI_IdValidator myIDValidator;
};
//---------------------------------------------------------------------------------
/*!
* \brief Operation creating 0D elements on all nodes of given elements
*/
class SMESHGUI_EXPORT SMESHGUI_Add0DElemsOnAllNodesOp : public SMESHGUI_SelectionOp
{
Q_OBJECT
public:
SMESHGUI_Add0DElemsOnAllNodesOp();
~SMESHGUI_Add0DElemsOnAllNodesOp();
virtual LightApp_Dialog* dlg() const { return myDlg; }
protected:
virtual void startOperation();
virtual void selectionDone();
virtual SUIT_SelectionFilter* createFilter( const int ) const;
protected slots:
virtual bool onApply();
void onSelTypeChange(int);
void onSetFilter();
private:
SMESHGUI_Add0DElemsOnAllNodesDlg* myDlg;
SMESHGUI_FilterDlg* myFilterDlg;
Handle(SALOME_InteractiveObject) myIO;
//SUIT_SelectionFilter* myObjectFilter;
};
#endif

View File

@ -742,14 +742,8 @@ void SMESHGUI_ClippingDlg::updateActorItem( QListWidgetItem* theItem,
if( anItem->checkState() == Qt::Checked ) if( anItem->checkState() == Qt::Checked )
aNbChecked++; aNbChecked++;
Qt::CheckState aCheckState = Qt::Unchecked;
if( aNbChecked == aNbItems )
aCheckState = Qt::Checked;
else if( aNbChecked > 0 )
aCheckState = Qt::PartiallyChecked;
bool anIsBlocked = SelectAllCheckBox->blockSignals( true ); bool anIsBlocked = SelectAllCheckBox->blockSignals( true );
SelectAllCheckBox->setCheckState( aCheckState ); SelectAllCheckBox->setCheckState( aNbChecked == aNbItems ? Qt::Checked : Qt::Unchecked);
SelectAllCheckBox->blockSignals( anIsBlocked ); SelectAllCheckBox->blockSignals( anIsBlocked );
} }

View File

@ -210,7 +210,7 @@ bool SMESHGUI_DeleteGroupDlg::onApply()
QList<SMESH::SMESH_GroupBase_var>::iterator anIter; QList<SMESH::SMESH_GroupBase_var>::iterator anIter;
for (anIter = myListGrp.begin(); anIter != myListGrp.end(); ++anIter) { for (anIter = myListGrp.begin(); anIter != myListGrp.end(); ++anIter) {
SMESH::SMESH_Mesh_ptr aMesh = (*anIter)->GetMesh(); SMESH::SMESH_Mesh_var aMesh = (*anIter)->GetMesh();
if (!aMesh->_is_nil()) if (!aMesh->_is_nil())
aMesh->RemoveGroupWithContents(*anIter); aMesh->RemoveGroupWithContents(*anIter);
} }
@ -218,6 +218,12 @@ bool SMESHGUI_DeleteGroupDlg::onApply()
myListBox->clear(); myListBox->clear();
myListGrp.clear(); myListGrp.clear();
mySelectionMgr->clearSelected(); mySelectionMgr->clearSelected();
/** Erase graphical objects **/
SALOME_ListIteratorOfListIO anIterIO (myListGrpIO);
for ( ; anIterIO.More(); anIterIO.Next())
SMESH::RemoveVisualObjectWithActors( anIterIO.Value()->getEntry(), /*fromAllViews=*/true );
SMESH::UpdateView(); SMESH::UpdateView();
SMESHGUI::Modified(); SMESHGUI::Modified();
mySMESHGUI->updateObjBrowser(true); mySMESHGUI->updateObjBrowser(true);
@ -285,6 +291,7 @@ void SMESHGUI_DeleteGroupDlg::onSelectionDone()
return; return;
myListGrp.clear(); myListGrp.clear();
myListGrpIO.Clear();
QStringList aNames; QStringList aNames;
SALOME_ListIO aListIO; SALOME_ListIO aListIO;
@ -296,6 +303,7 @@ void SMESHGUI_DeleteGroupDlg::onSelectionDone()
if (!aGroup->_is_nil()) { if (!aGroup->_is_nil()) {
aNames.append(aGroup->GetName()); aNames.append(aGroup->GetName());
myListGrp.append(aGroup); myListGrp.append(aGroup);
myListGrpIO.Append( anIter.Value() );
} }
} }

View File

@ -29,6 +29,8 @@
// SMESH includes // SMESH includes
#include "SMESH_SMESHGUI.hxx" #include "SMESH_SMESHGUI.hxx"
#include <SALOME_ListIO.hxx>
// Qt includes // Qt includes
#include <QDialog> #include <QDialog>
@ -86,6 +88,7 @@ private:
SMESHGUI* mySMESHGUI; SMESHGUI* mySMESHGUI;
LightApp_SelectionMgr* mySelectionMgr; LightApp_SelectionMgr* mySelectionMgr;
SALOME_ListIO myListGrpIO;
QList<SMESH::SMESH_GroupBase_var> myListGrp; QList<SMESH::SMESH_GroupBase_var> myListGrp;
bool myBlockSelection; bool myBlockSelection;

View File

@ -91,6 +91,7 @@
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
: SMESHGUI_PreviewDlg( theModule ), : SMESHGUI_PreviewDlg( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myEditCurrentArgument(0),
myFilterDlg( 0 ), myFilterDlg( 0 ),
mySelectedObject(SMESH::SMESH_IDSource::_nil()) mySelectedObject(SMESH::SMESH_IDSource::_nil())
{ {

View File

@ -1002,6 +1002,17 @@ void SMESHGUI_FilterTable::Init (const QList<int>& theTypes)
myLibDlg = 0; myLibDlg = 0;
} }
else
{
QList<int>::const_iterator typeIt = theTypes.begin();
for ( ; typeIt != theTypes.end(); ++typeIt ) {
if ( !myTables[ *typeIt ] ) {
Table* aTable = createTable(mySwitchTableGrp, *typeIt);
myTables[ *typeIt ] = aTable;
((QVBoxLayout*)mySwitchTableGrp->layout())->addWidget(myTables[ *typeIt ]);
}
}
}
// Hide buttons of entity types if necessary // Hide buttons of entity types if necessary
const QMap<int, QString>& aSupportedTypes = getSupportedTypes(); const QMap<int, QString>& aSupportedTypes = getSupportedTypes();

View File

@ -572,6 +572,8 @@ QString SMESHGUI_GenericHypothesisCreator::helpPage() const
aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor"; aHelpFileName = "a2d_meshing_hypo_page.html#hypo_quad_params_anchor";
else if ( aHypType == "ViscousLayers") else if ( aHypType == "ViscousLayers")
aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor"; aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
else if ( aHypType == "ViscousLayers2D")
aHelpFileName = "additional_hypo_page.html#viscous_layers_anchor";
else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D") else if ( aHypType == "ImportSource1D" || aHypType == "ImportSource2D")
aHelpFileName = "import_algos_page.html"; aHelpFileName = "import_algos_page.html";
return aHelpFileName; return aHelpFileName;

View File

@ -74,7 +74,7 @@
#endif #endif
#ifdef _DEBUG_ #ifdef _DEBUG_
static int MYDEBUG = 0; static int MYDEBUG = 1;
#else #else
static int MYDEBUG = 0; static int MYDEBUG = 0;
#endif #endif
@ -420,13 +420,13 @@ namespace SMESH
LibHandle libHandle = LoadLib( aClientLibName.toLatin1().data() ); LibHandle libHandle = LoadLib( aClientLibName.toLatin1().data() );
if (!libHandle) { if (!libHandle) {
// report any error, if occured // report any error, if occured
if ( MYDEBUG ) { {
#ifdef WIN32 #ifdef WIN32
const char* anError = "Can't load client meshers plugin library"; const char* anError = "Can't load client meshers plugin library";
#else #else
const char* anError = dlerror(); const char* anError = dlerror();
#endif #endif
MESSAGE(anError); INFOS(anError); // always display this kind of error !
} }
} }
else { else {

View File

@ -1105,6 +1105,7 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_3D" ) ).arg( afunctor->GetValue( id ) ) ); myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_3D" ) ).arg( afunctor->GetValue( id ) ) );
} }
/*
if( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) { if( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
// separator // separator
myInfo->append( "" ); myInfo->append( "" );
@ -1121,6 +1122,7 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
myInfo->append( QString( "<b>%1:</b> %2 #%3" ).arg( tr( "Position" ) ).arg( shapeType ).arg( shapeID ) ); myInfo->append( QString( "<b>%1:</b> %2 #%3" ).arg( tr( "Position" ) ).arg( shapeType ).arg( shapeID ) );
} }
} }
*/
} }
// separator // separator
if ( ids.count() > 1 ) { if ( ids.count() > 1 ) {
@ -1539,6 +1541,7 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
diam3Item->setText( 0, tr( "MAX_ELEMENT_LENGTH_3D" ) ); diam3Item->setText( 0, tr( "MAX_ELEMENT_LENGTH_3D" ) );
diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) ); diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
} }
/*
if( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) { if( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
//shapeID //shapeID
int shapeID = e->getshapeId(); int shapeID = e->getshapeId();
@ -1555,6 +1558,7 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
shItem->setText( 1, QString( "%1 #%2" ).arg(shapeType).arg( shapeID ) ); shItem->setText( 1, QString( "%1 #%2" ).arg(shapeType).arg( shapeID ) );
} }
} }
*/
} }
} }
} }

View File

@ -1965,10 +1965,9 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
//================================================================================ //================================================================================
/*! /*!
* \brief Reads parameters of edited mesh and assigns them to the dialog * \brief Reads parameters of an edited mesh and assigns them to the dialog
* *
* Reads parameters of edited mesh and assigns them to the dialog (called when * Called when mesh is edited only.
* mesh is edited only)
*/ */
//================================================================================ //================================================================================
void SMESHGUI_MeshOp::readMesh() void SMESHGUI_MeshOp::readMesh()
@ -2005,8 +2004,8 @@ void SMESHGUI_MeshOp::readMesh()
// Get hypotheses and algorithms assigned to the mesh/sub-mesh // Get hypotheses and algorithms assigned to the mesh/sub-mesh
QStringList anExisting; QStringList anExisting;
const int aDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D; const int lastDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D;
for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ ) for ( int dim = SMESH::DIM_3D; dim >= lastDim; --dim )
{ {
// get algorithm // get algorithm
existingHyps( dim, Algo, pObj, anExisting, myObjHyps[ dim ][ Algo ] ); existingHyps( dim, Algo, pObj, anExisting, myObjHyps[ dim ][ Algo ] );
@ -2030,7 +2029,7 @@ void SMESHGUI_MeshOp::readMesh()
// get hypotheses // get hypotheses
bool hypWithoutAlgo = false; bool hypWithoutAlgo = false;
for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ ) for ( int dim = SMESH::DIM_3D; dim >= lastDim; --dim )
{ {
for ( int hypType = MainHyp; hypType <= AddHyp; hypType++ ) for ( int hypType = MainHyp; hypType <= AddHyp; hypType++ )
{ {

View File

@ -225,7 +225,7 @@ QWidget* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool
myComboBoxFunctor->addItem(tr("ASPECTRATIO_ELEMENTS")); myComboBoxFunctor->addItem(tr("ASPECTRATIO_ELEMENTS"));
myComboBoxFunctor->addItem(tr("MINIMUMANGLE_ELEMENTS")); myComboBoxFunctor->addItem(tr("MINIMUMANGLE_ELEMENTS"));
myComboBoxFunctor->addItem(tr("SKEW_ELEMENTS")); myComboBoxFunctor->addItem(tr("SKEW_ELEMENTS"));
myComboBoxFunctor->addItem(tr("AREA_ELEMENTS")); //myComboBoxFunctor->addItem(tr("AREA_ELEMENTS"));
//myComboBoxFunctor->addItem(tr("LENGTH2D_EDGES")); // for existing elements only //myComboBoxFunctor->addItem(tr("LENGTH2D_EDGES")); // for existing elements only
//myComboBoxFunctor->addItem(tr("MULTI2D_BORDERS")); // for existing elements only //myComboBoxFunctor->addItem(tr("MULTI2D_BORDERS")); // for existing elements only
myComboBoxFunctor->setCurrentIndex(0); myComboBoxFunctor->setCurrentIndex(0);
@ -362,6 +362,8 @@ SMESH::NumericalFunctor_ptr SMESHGUI_MultiEditDlg::getNumericalFunctor()
aNF = aFilterMgr->CreateLength2D(); aNF = aFilterMgr->CreateLength2D();
else if (myComboBoxFunctor->currentText() == tr("MULTI2D_BORDERS")) else if (myComboBoxFunctor->currentText() == tr("MULTI2D_BORDERS"))
aNF = aFilterMgr->CreateMultiConnection2D(); aNF = aFilterMgr->CreateMultiConnection2D();
else if (myComboBoxFunctor->currentText() == tr("MIN_DIAG_ELEMENTS"))
aNF = aFilterMgr->CreateMaxElementLength2D();
else; else;
return aNF._retn(); return aNF._retn();
@ -1154,6 +1156,7 @@ SMESHGUI_UnionOfTrianglesDlg
setWindowTitle(tr("CAPTION")); setWindowTitle(tr("CAPTION"));
myComboBoxFunctor->setEnabled(true); myComboBoxFunctor->setEnabled(true);
myComboBoxFunctor->addItem(tr("AREA_ELEMENTS"));
myComboBoxFunctor->addItem(tr("WARP_ELEMENTS")); // for quadrangles only myComboBoxFunctor->addItem(tr("WARP_ELEMENTS")); // for quadrangles only
myComboBoxFunctor->addItem(tr("TAPER_ELEMENTS")); // for quadrangles only myComboBoxFunctor->addItem(tr("TAPER_ELEMENTS")); // for quadrangles only
@ -1240,6 +1243,8 @@ SMESHGUI_CuttingOfQuadsDlg
myCriterionGrp->show(); myCriterionGrp->show();
myChoiceWidget->show(); myChoiceWidget->show();
myComboBoxFunctor->insertItem(0, tr("MIN_DIAG_ELEMENTS"));
myComboBoxFunctor->setCurrentIndex(0);
myComboBoxFunctor->setEnabled(false); myComboBoxFunctor->setEnabled(false);
connect(myPreviewChk, SIGNAL(stateChanged(int)), this, SLOT(onPreviewChk())); connect(myPreviewChk, SIGNAL(stateChanged(int)), this, SLOT(onPreviewChk()));

View File

@ -491,9 +491,16 @@ void SMESHGUI_SelectionOp::onTextChanged( int, const QStringList& list )
IdList ids; extractIds( list, ids, '\0' ); IdList ids; extractIds( list, ids, '\0' );
IdList::const_iterator anIt = ids.begin(), IdList::const_iterator anIt = ids.begin(),
aLast = ids.end(); aLast = ids.end();
for( ; anIt!=aLast; anIt++ ) if ( selectionMode() == NodeSelection )
if( const SMDS_MeshNode * n = aMesh->FindNode( *anIt ) ) for( ; anIt!=aLast; anIt++ ) {
newIndices.Add( n->GetID() ); if( const SMDS_MeshNode * n = aMesh->FindNode( *anIt ) )
newIndices.Add( n->GetID() );
}
else
for( ; anIt!=aLast; anIt++ ) {
if( const SMDS_MeshElement* e = aMesh->FindElement( *anIt ) )
newIndices.Add( e->GetID() );
}
selector()->AddOrRemoveIndex( sel.First(), newIndices, false ); selector()->AddOrRemoveIndex( sel.First(), newIndices, false );
highlight( sel.First(), true, true ); highlight( sel.First(), true, true );

View File

@ -105,7 +105,11 @@
</message> </message>
<message> <message>
<source>ICON_DLG_ELEM0D</source> <source>ICON_DLG_ELEM0D</source>
<translation>mesh_vertex.png</translation> <translation>mesh_0D_elem.png</translation>
</message>
<message>
<source>ICON_0D_ON_ALL_NODES</source>
<translation>mesh_0D_on_all_nodes.png</translation>
</message> </message>
<message> <message>
<source>ICON_DLG_EDGE</source> <source>ICON_DLG_EDGE</source>

View File

@ -63,6 +63,10 @@
<source>AREA_ELEMENTS</source> <source>AREA_ELEMENTS</source>
<translation>Area</translation> <translation>Area</translation>
</message> </message>
<message>
<source>MIN_DIAG_ELEMENTS</source>
<translation>Minimum diagonal</translation>
</message>
<message> <message>
<source>ASPECTRATIO_3D_ELEMENTS</source> <source>ASPECTRATIO_3D_ELEMENTS</source>
<translation>Aspect Ratio 3D</translation> <translation>Aspect Ratio 3D</translation>
@ -160,6 +164,10 @@
<source>ELEMENT_ID</source> <source>ELEMENT_ID</source>
<translation>Element ID</translation> <translation>Element ID</translation>
</message> </message>
<message>
<source>ELEMENT_IDS</source>
<translation>Element IDs</translation>
</message>
<message> <message>
<source>FREE_BORDERS</source> <source>FREE_BORDERS</source>
<translation>Free Borders</translation> <translation>Free Borders</translation>
@ -372,6 +380,10 @@
<source>MEN_ELEMS0D</source> <source>MEN_ELEMS0D</source>
<translation>0D Elements</translation> <translation>0D Elements</translation>
</message> </message>
<message>
<source>MEN_0D_ON_ALL_NODES</source>
<translation>0D Elements on Element Nodes</translation>
</message>
<message> <message>
<source>MEN_BALL</source> <source>MEN_BALL</source>
<translation>Ball</translation> <translation>Ball</translation>
@ -1075,6 +1087,10 @@ Do you want to convert it to the standalone group?</translation>
<source>NODE_ID</source> <source>NODE_ID</source>
<translation>Node ID</translation> <translation>Node ID</translation>
</message> </message>
<message>
<source>NODE_IDS</source>
<translation>Node IDs</translation>
</message>
<message> <message>
<source>NON_SMESH_OBJECTS_SELECTED</source> <source>NON_SMESH_OBJECTS_SELECTED</source>
<translation>There are objects selected which do not belong to %1 component.</translation> <translation>There are objects selected which do not belong to %1 component.</translation>
@ -1257,6 +1273,10 @@ Please enter correct values and try again</translation>
<source>SMESH_AUTO_GROUPS</source> <source>SMESH_AUTO_GROUPS</source>
<translation>Automatically create groups</translation> <translation>Automatically create groups</translation>
</message> </message>
<message>
<source>SMESH_REQUIRED_GROUPS</source>
<translation>Create groups of required entities</translation>
</message>
<message> <message>
<source>SMESH_AVAILABLE</source> <source>SMESH_AVAILABLE</source>
<translation>Available</translation> <translation>Available</translation>
@ -2435,7 +2455,11 @@ Check algorithm documentation for supported geometry</translation>
</message> </message>
<message> <message>
<source>SMESH_SELECT_WHOLE_MESH</source> <source>SMESH_SELECT_WHOLE_MESH</source>
<translation>Select whole mesh, submesh or group</translation> <translation>Select whole mesh, sub-mesh or group</translation>
</message>
<message>
<source>SMESH_SUBMESH_GROUP</source>
<translation>Mesh, sub-mesh, group</translation>
</message> </message>
<message> <message>
<source>SMESH_SET_COLOR</source> <source>SMESH_SET_COLOR</source>
@ -2829,6 +2853,10 @@ Please check preferences of Mesh module.
<source>STB_ELEM0D</source> <source>STB_ELEM0D</source>
<translation>0D Element</translation> <translation>0D Element</translation>
</message> </message>
<message>
<source>STB_0D_ON_ALL_NODES</source>
<translation>Make 0D Elements on Element Nodes</translation>
</message>
<message> <message>
<source>STB_ELEMS0D</source> <source>STB_ELEMS0D</source>
<translation>0D Elements</translation> <translation>0D Elements</translation>
@ -3437,6 +3465,10 @@ Please check preferences of Mesh module.
<source>TOP_DISP_ENT</source> <source>TOP_DISP_ENT</source>
<translation>Display entity</translation> <translation>Display entity</translation>
</message> </message>
<message>
<source>TOP_0D_ON_ALL_NODES</source>
<translation>Make 0D Elements on Element Nodes</translation>
</message>
<message> <message>
<source>TOP_ELEM0D</source> <source>TOP_ELEM0D</source>
<translation>0D Element</translation> <translation>0D Element</translation>
@ -4014,10 +4046,18 @@ It can&apos;t be deleted </translation>
</message> </message>
</context> </context>
<context> <context>
<name>SMESHGUI_GroupDlg</name> <name>SMESHGUI_Dialog</name>
<message> <message>
<source>ALLOW_ELEM_LIST_MODIF</source> <source>DLG_MESH</source>
<translation>Enable manual edition</translation> <translation>meshes</translation>
</message>
<message>
<source>DLG_HYPO</source>
<translation>hypotheses</translation>
</message>
<message>
<source>DLG_ALGO</source>
<translation>algorithms</translation>
</message> </message>
</context> </context>
<context> <context>
@ -4328,6 +4368,35 @@ Please, create VTK viewer and try again</translation>
<translation>Sub-shapes preview chunk size</translation> <translation>Sub-shapes preview chunk size</translation>
</message> </message>
</context> </context>
<context>
<name>SMESHGUI_GroupDlg</name>
<message>
<source>ALLOW_ELEM_LIST_MODIF</source>
<translation>Enable manual edition</translation>
</message>
</context>
<context>
<name>SMESHGUI_Add0DElemsOnAllNodesDlg</name>
<message>
<source>CAPTION</source>
<translation>Make 0D Elements on Element Nodes</translation>
</message>
<message>
<source>OBJ_BTN</source>
<translation>Mesh, sub-mesh, group</translation>
</message>
<message>
<source>NB_NEW_0D</source>
<translation>%1 0D elements created</translation>
</message>
</context>
<context>
<name>SMESHGUI_Add0DElemsOnAllNodesOp</name>
<message>
<source>NB_NEW_0D</source>
<translation>%1 0D elements created</translation>
</message>
</context>
<context> <context>
<name>SMESHGUI_AddQuadraticElementDlg</name> <name>SMESHGUI_AddQuadraticElementDlg</name>
<message> <message>

View File

@ -3993,6 +3993,21 @@ avec le paramètre &apos;%1&apos; des préférences du module Mesh.</translation
Il ne peut pas être supprimé.</translation> Il ne peut pas être supprimé.</translation>
</message> </message>
</context> </context>
<context>
<name>SMESHGUI_Dialog</name>
<message>
<source>DLG_MESH</source>
<translation>maillages</translation>
</message>
<message>
<source>DLG_HYPO</source>
<translation>hypothèses</translation>
</message>
<message>
<source>DLG_ALGO</source>
<translation>algorithmes</translation>
</message>
</context>
<context> <context>
<name>SMESHGUI_GroupDlg</name> <name>SMESHGUI_GroupDlg</name>
<message> <message>

View File

@ -124,6 +124,31 @@ namespace {
} }
}; };
//================================================================================
/*!
* \brief Map of TCollection_AsciiString initialized by C array of C strings.
* Odd items of the C array are map keys, and even items are values
*/
//================================================================================
struct TStringMap: public map<TCollection_AsciiString,TCollection_AsciiString>
{
/*!
* \brief Filling. The last string must be ""
*/
void Insert(const char* names_values[]) {
for ( int i = 0; names_values[i][0] ; i += 2 )
insert( make_pair( (char*) names_values[i], names_values[i+1] ));
}
/*!
* \brief Check if a string is in
*/
TCollection_AsciiString Value(const TCollection_AsciiString& name ) {
map< _AString, _AString >::iterator it = find( name );
return it == end() ? "" : it->second;
}
};
//================================================================================ //================================================================================
/*! /*!
* \brief Returns a mesh by object * \brief Returns a mesh by object
@ -533,10 +558,14 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
groups = aCommand->GetResultValue(2); groups = aCommand->GetResultValue(2);
else if ( method == "MakeBoundaryElements") else if ( method == "MakeBoundaryElements")
groups = aCommand->GetResultValue(3); groups = aCommand->GetResultValue(3);
else if ( method == "Create0DElementsOnAllNodes" &&
aCommand->GetArg(2).Length() > 2 ) // group name != ''
groups = aCommand->GetResultValue();
id_editor->second->Process( aCommand ); id_editor->second->Process( aCommand );
id_editor->second->AddProcessedCmd( aCommand ); id_editor->second->AddProcessedCmd( aCommand );
// create meshes
if ( !meshID.IsEmpty() && if ( !meshID.IsEmpty() &&
!myMeshes.count( meshID ) && !myMeshes.count( meshID ) &&
aCommand->IsStudyEntry( meshID )) aCommand->IsStudyEntry( meshID ))
@ -547,6 +576,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
aCommand->Clear(); aCommand->Clear();
aCommand->GetString() = processedCommand; // discard changes made by _pyMesh aCommand->GetString() = processedCommand; // discard changes made by _pyMesh
} }
// create groups
if ( !groups.IsEmpty() ) if ( !groups.IsEmpty() )
{ {
if ( !aCommand->IsStudyEntry( meshID )) if ( !aCommand->IsStudyEntry( meshID ))
@ -730,7 +760,9 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
myMeshes.insert( make_pair( mesh->GetID(), mesh )); myMeshes.insert( make_pair( mesh->GetID(), mesh ));
return; return;
} }
if( method == "CreateMeshesFromMED" || method == "CreateMeshesFromSAUV") if( method == "CreateMeshesFromMED" ||
method == "CreateMeshesFromSAUV"||
method == "CreateMeshesFromGMF" )
{ {
for(int ind = 0;ind<theCommand->GetNbResultValues();ind++) for(int ind = 0;ind<theCommand->GetNbResultValues();ind++)
{ {
@ -786,7 +818,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
} }
} }
// objects erasing creation command if no more it's commands invoked: // objects erasing creation command if no more its commands invoked:
// SMESH_Pattern, FilterManager // SMESH_Pattern, FilterManager
if ( method == "GetPattern" || if ( method == "GetPattern" ||
method == "CreateFilterManager" || method == "CreateFilterManager" ||
@ -1503,6 +1535,33 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
myGroups.push_back( group ); myGroups.push_back( group );
theGen->AddObject( group ); theGen->AddObject( group );
} }
// update list of groups
else if ( method == "GetGroups" )
{
TCollection_AsciiString grIDs = theCommand->GetResultValue();
list< _pyID > idList = theCommand->GetStudyEntries( grIDs );
list< _pyID >::iterator grID = idList.begin();
for ( ; grID != idList.end(); ++grID )
{
Handle(_pyObject) obj = theGen->FindObject( *grID );
if ( obj.IsNull() )
{
Handle(_pyGroup) group = new _pyGroup( theCommand, *grID );
theGen->AddObject( group );
myGroups.push_back( group );
}
}
}
// notify a group about full removal
else if ( method == "RemoveGroupWithContents" )
{
if ( !theGen->IsToKeepAllCommands() ) { // snapshot mode
const _pyID groupID = theCommand->GetArg( 1 );
Handle(_pyGroup) grp = Handle(_pyGroup)::DownCast( theGen->FindObject( groupID ));
if ( !grp.IsNull() )
grp->RemovedWithContents();
}
}
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
else if ( theCommand->MethodStartsFrom( "Export" )) else if ( theCommand->MethodStartsFrom( "Export" ))
{ {
@ -1604,23 +1663,6 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
subMesh->Process( theCommand ); // it moves GetSubMesh() before theCommand subMesh->Process( theCommand ); // it moves GetSubMesh() before theCommand
} }
} }
// update list of groups
else if ( method == "GetGroups" )
{
TCollection_AsciiString grIDs = theCommand->GetResultValue();
list< _pyID > idList = theCommand->GetStudyEntries( grIDs );
list< _pyID >::iterator grID = idList.begin();
for ( ; grID != idList.end(); ++grID )
{
Handle(_pyObject) obj = theGen->FindObject( *grID );
if ( obj.IsNull() )
{
Handle(_pyGroup) group = new _pyGroup( theCommand, *grID );
theGen->AddObject( group );
myGroups.push_back( group );
}
}
}
// add accessor method if necessary // add accessor method if necessary
else else
{ {
@ -1929,14 +1971,15 @@ _pyMeshEditor::_pyMeshEditor(const Handle(_pyCommand)& theCreationCmd):
void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
{ {
// names of SMESH_MeshEditor methods fully equal to methods of python class Mesh, so // names of SMESH_MeshEditor methods fully equal to methods of the python class Mesh, so
// commands calling this methods are converted to calls of methods of Mesh // commands calling this methods are converted to calls of Mesh methods
static TStringSet sameMethods; static TStringSet sameMethods;
if ( sameMethods.empty() ) { if ( sameMethods.empty() ) {
const char * names[] = { const char * names[] = {
"RemoveElements","RemoveNodes","RemoveOrphanNodes","AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace","AddBall", "RemoveElements","RemoveNodes","RemoveOrphanNodes","AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace","AddBall",
"AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","MoveNode", "MoveClosestNodeToPoint", "AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","MoveNode", "MoveClosestNodeToPoint",
"InverseDiag","DeleteDiag","Reorient","ReorientObject","TriToQuad","SplitQuad","SplitQuadObject", "InverseDiag","DeleteDiag","Reorient","ReorientObject",
"TriToQuad","TriToQuadObject", "SplitQuad","SplitQuadObject",
"BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject", "BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",
"ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements", "ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements",
"RotationSweep","RotationSweepObject","RotationSweepObject1D","RotationSweepObject2D", "RotationSweep","RotationSweepObject","RotationSweepObject1D","RotationSweepObject2D",
@ -1955,7 +1998,21 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
sameMethods.Insert( names ); sameMethods.Insert( names );
} }
// names of SMESH_MeshEditor methods which differ from methods of class Mesh // names of SMESH_MeshEditor commands in which only a method name must be replaced
TStringMap diffMethods;
if ( diffMethods.empty() ) {
const char * orig2newName[] = {
// original name --------------> new name
"ExtrusionAlongPathObjX" , "ExtrusionAlongPathX",
"FindCoincidentNodesOnPartBut", "FindCoincidentNodesOnPart",
"ConvertToQuadraticObject" , "ConvertToQuadratic",
"ConvertFromQuadraticObject" , "ConvertFromQuadratic",
"Create0DElementsOnAllNodes" , "Add0DElementsToAllNodes",
""};// <- mark of the end
diffMethods.Insert( orig2newName );
}
// names of SMESH_MeshEditor methods which differ from methods of Mesh class
// only by last two arguments // only by last two arguments
static TStringSet diffLastTwoArgsMethods; static TStringSet diffLastTwoArgsMethods;
if (diffLastTwoArgsMethods.empty() ) { if (diffLastTwoArgsMethods.empty() ) {
@ -1967,13 +2024,21 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
diffLastTwoArgsMethods.Insert( names ); diffLastTwoArgsMethods.Insert( names );
} }
// only a method name is to change?
const TCollection_AsciiString & method = theCommand->GetMethod(); const TCollection_AsciiString & method = theCommand->GetMethod();
bool isPyMeshMethod = sameMethods.Contains( method ); bool isPyMeshMethod = sameMethods.Contains( method );
if ( !isPyMeshMethod ) if ( !isPyMeshMethod )
{ {
//Replace SMESH_MeshEditor "MakeGroups" functions by the Mesh TCollection_AsciiString newMethod = diffMethods.Value( method );
//functions with the flag "theMakeGroups = True" like: if (( isPyMeshMethod = ( newMethod.Length() > 0 )))
//SMESH_MeshEditor.CmdMakeGroups => Mesh.Cmd(...,True) theCommand->SetMethod( newMethod );
}
if ( !isPyMeshMethod )
{
// Replace SMESH_MeshEditor "*MakeGroups" functions by the Mesh
// functions with the flag "theMakeGroups = True" like:
// SMESH_MeshEditor.CmdMakeGroups => Mesh.Cmd(...,True)
int pos = method.Search("MakeGroups"); int pos = method.Search("MakeGroups");
if( pos != -1) if( pos != -1)
{ {
@ -1998,7 +2063,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
} }
} }
// ExtrusionSweep0D() -> ExtrusionSweep() // ExtrusionSweep0D() -> ExtrusionSweep()
// ExtrusionSweepObject0D() -> ExtrusionSweepObject() // ExtrusionSweepObject0D() -> ExtrusionSweepObject()
if ( !isPyMeshMethod && ( method == "ExtrusionSweep0D" || if ( !isPyMeshMethod && ( method == "ExtrusionSweep0D" ||
method == "ExtrusionSweepObject0D" )) method == "ExtrusionSweepObject0D" ))
@ -2008,19 +2073,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
theCommand->SetArg(theCommand->GetNbArgs()+1,"False"); //sets flag "MakeGroups = False" theCommand->SetArg(theCommand->GetNbArgs()+1,"False"); //sets flag "MakeGroups = False"
theCommand->SetArg(theCommand->GetNbArgs()+1,"True"); //sets flag "IsNode = True" theCommand->SetArg(theCommand->GetNbArgs()+1,"True"); //sets flag "IsNode = True"
} }
// set "ExtrusionAlongPathX()" instead of "ExtrusionAlongPathObjX()"
if ( !isPyMeshMethod && method == "ExtrusionAlongPathObjX")
{
isPyMeshMethod = true;
theCommand->SetMethod("ExtrusionAlongPathX");
}
// set "FindCoincidentNodesOnPart()" instead of "FindCoincidentNodesOnPartBut()"
if ( !isPyMeshMethod && method == "FindCoincidentNodesOnPartBut")
{
isPyMeshMethod = true;
theCommand->SetMethod("FindCoincidentNodesOnPart");
}
// DoubleNode...New(...) -> DoubleNode...(...,True) // DoubleNode...New(...) -> DoubleNode...(...,True)
if ( !isPyMeshMethod && ( method == "DoubleNodeElemGroupNew" || if ( !isPyMeshMethod && ( method == "DoubleNodeElemGroupNew" ||
method == "DoubleNodeElemGroupsNew" || method == "DoubleNodeElemGroupsNew" ||
@ -2045,14 +2098,6 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
theCommand->SetResultValue( groupID ); theCommand->SetResultValue( groupID );
} }
} }
// ConvertToQuadraticObject(bool,obj) -> ConvertToQuadratic(bool,obj)
// ConvertFromQuadraticObject(obj) -> ConvertFromQuadratic(obj)
if ( !isPyMeshMethod && ( method == "ConvertToQuadraticObject" ||
method == "ConvertFromQuadraticObject" ))
{
isPyMeshMethod = true;
theCommand->SetMethod( method.SubString( 1, method.Length()-6));
}
// FindAmongElementsByPoint(meshPart, x, y, z, elementType) -> // FindAmongElementsByPoint(meshPart, x, y, z, elementType) ->
// FindElementsByPoint(x, y, z, elementType, meshPart) // FindElementsByPoint(x, y, z, elementType, meshPart)
if ( !isPyMeshMethod && method == "FindAmongElementsByPoint" ) if ( !isPyMeshMethod && method == "FindAmongElementsByPoint" )
@ -2083,10 +2128,15 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
theCommand->SetArg( 3, face ); theCommand->SetArg( 3, face );
} }
// meshes made by *MakeMesh() methods are not wrapped by _pyMesh, if ( method == "QuadToTri" || method == "QuadToTriObject" )
// so let _pyMesh care of it (TMP?) {
// if ( theCommand->GetMethod().Search("MakeMesh") != -1 ) isPyMeshMethod = true;
// _pyMesh( new _pyCommand( theCommand->GetString(), 0 )); // for theGen->SetAccessorMethod() int crit_arg = theCommand->GetNbArgs();
const _AString& crit = theCommand->GetArg(crit_arg);
if (crit.Search("MaxElementLength2D") != -1)
theCommand->SetArg(crit_arg, "");
}
if ( isPyMeshMethod ) if ( isPyMeshMethod )
{ {
theCommand->SetObject( myMesh ); theCommand->SetObject( myMesh );
@ -2094,7 +2144,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
else else
{ {
// editor creation command is needed only if any editor function is called // editor creation command is needed only if any editor function is called
theGen->AddMeshAccessorMethod( theCommand ); // for *Object() theGen->AddMeshAccessorMethod( theCommand ); // for *Object() methods
if ( !myCreationCmdStr.IsEmpty() ) { if ( !myCreationCmdStr.IsEmpty() ) {
GetCreationCmd()->GetString() = myCreationCmdStr; GetCreationCmd()->GetString() = myCreationCmdStr;
myCreationCmdStr.Clear(); myCreationCmdStr.Clear();
@ -3766,7 +3816,7 @@ bool _pySubMesh::CanBeArgOfMethod(const _AString& theMethodName)
"TranslateObjectMakeGroups","TranslateObjectMakeMesh","ScaleMakeGroups","ScaleMakeMesh", "TranslateObjectMakeGroups","TranslateObjectMakeMesh","ScaleMakeGroups","ScaleMakeMesh",
"RotateObject","RotateObjectMakeGroups","RotateObjectMakeMesh","FindCoincidentNodesOnPart", "RotateObject","RotateObjectMakeGroups","RotateObjectMakeMesh","FindCoincidentNodesOnPart",
"FindCoincidentNodesOnPartBut","FindEqualElements","FindAmongElementsByPoint", "FindCoincidentNodesOnPartBut","FindEqualElements","FindAmongElementsByPoint",
"MakeBoundaryMesh", "MakeBoundaryMesh","Create0DElementsOnAllNodes",
"" }; // <- mark of end "" }; // <- mark of end
methods.Insert( names ); methods.Insert( names );
} }
@ -3864,6 +3914,21 @@ _pyGroup::_pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id)
} }
} }
//================================================================================
/*!
* \brief set myCanClearCreationCmd = true if the main action of the creation
* command is discarded
*/
//================================================================================
void _pyGroup::RemovedWithContents()
{
// this code would be appropriate if Add0DElementsToAllNodes() returned only new nodes
// via a created group
//if ( GetCreationCmd()->GetMethod() == "Add0DElementsToAllNodes")
// myCanClearCreationCmd = true;
}
//================================================================================ //================================================================================
/*! /*!
* \brief To convert creation of a group by filter * \brief To convert creation of a group by filter
@ -3941,8 +4006,6 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand)
//================================================================================ //================================================================================
/*! /*!
* \brief Prevent clearing "DoubleNode...() command if a group created by it is removed * \brief Prevent clearing "DoubleNode...() command if a group created by it is removed
*
*
*/ */
//================================================================================ //================================================================================

View File

@ -591,6 +591,7 @@ public:
virtual void Process( const Handle(_pyCommand)& theCommand); virtual void Process( const Handle(_pyCommand)& theCommand);
virtual void Flush(); virtual void Flush();
virtual void Free() { myFilter.Nullify(); } virtual void Free() { myFilter.Nullify(); }
void RemovedWithContents();
DEFINE_STANDARD_RTTI (_pyGroup) DEFINE_STANDARD_RTTI (_pyGroup)
}; };

View File

@ -1232,6 +1232,7 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromCGNS( const char* theFileName,
SMESH::SMESH_Mesh_ptr SMESH::SMESH_Mesh_ptr
SMESH_Gen_i::CreateMeshesFromGMF( const char* theFileName, SMESH_Gen_i::CreateMeshesFromGMF( const char* theFileName,
CORBA::Boolean theMakeRequiredGroups,
SMESH::ComputeError_out theError) SMESH::ComputeError_out theError)
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
{ {
@ -1254,12 +1255,14 @@ SMESH_Gen_i::CreateMeshesFromGMF( const char* theFileName,
aStudyBuilder->CommitCommand(); aStudyBuilder->CommitCommand();
if ( !aSO->_is_nil() ) { if ( !aSO->_is_nil() ) {
// Update Python script // Update Python script
TPythonDump() << "("<< aSO << ", error) = " << this << ".CreateMeshesFromGMF(r'" << theFileName << "')"; TPythonDump() << "("<< aSO << ", error) = " << this << ".CreateMeshesFromGMF(r'"
<< theFileName << "', "
<< theMakeRequiredGroups << " )";
} }
} }
SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() ); SMESH_Mesh_i* aServant = dynamic_cast<SMESH_Mesh_i*>( GetServant( aMesh ).in() );
ASSERT( aServant ); ASSERT( aServant );
theError = aServant->ImportGMFFile( theFileName ); theError = aServant->ImportGMFFile( theFileName, theMakeRequiredGroups );
aServant->GetImpl().GetMeshDS()->Modified(); aServant->GetImpl().GetMeshDS()->Modified();
return aMesh._retn(); return aMesh._retn();
} }

View File

@ -263,6 +263,7 @@ public:
// Create a mesh and import data from a GMF file // Create a mesh and import data from a GMF file
SMESH::SMESH_Mesh_ptr CreateMeshesFromGMF( const char* theFileName, SMESH::SMESH_Mesh_ptr CreateMeshesFromGMF( const char* theFileName,
CORBA::Boolean theMakeRequiredGroups,
SMESH::ComputeError_out theError) SMESH::ComputeError_out theError)
throw ( SALOME::SALOME_Exception ); throw ( SALOME::SALOME_Exception );

File diff suppressed because it is too large Load Diff

View File

@ -40,6 +40,10 @@
class SMESH_Mesh_i; class SMESH_Mesh_i;
namespace MeshEditor_I {
struct TPreviewMesh;
}
class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
{ {
public: public:
@ -100,6 +104,19 @@ public:
const SMESH::long_array & Quantities); const SMESH::long_array & Quantities);
CORBA::Long AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces); CORBA::Long AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces);
/*!
* \brief Create 0D elements on all nodes of the given object except those
* nodes on which a 0D element already exists.
* \param theObject object on whose nodes 0D elements will be created.
* \param theGroupName optional name of a group to add 0D elements created
* and/or found on nodes of \a theObject.
* \return an object (a new group or a temporary SMESH_IDSource) holding
* ids of new and/or found 0D elements.
*/
SMESH::SMESH_IDSource_ptr Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObject,
const char* theGroupName)
throw (SALOME::SALOME_Exception);
/*! /*!
* \brief Bind a node to a vertex * \brief Bind a node to a vertex
* \param NodeID - node ID * \param NodeID - node ID
@ -822,13 +839,17 @@ public:
private: //!< private methods private: //!< private methods
SMESHDS_Mesh * GetMeshDS() { return myMesh->GetMeshDS(); } ::SMESH_MeshEditor& getEditor();
SMESHDS_Mesh * getMeshDS() { return myMesh->GetMeshDS(); }
MeshEditor_I::TPreviewMesh * getPreviewMesh( SMDSAbs_ElementType previewType = SMDSAbs_All );
/*! /*!
* \brief Update myLastCreated* or myPreviewData * \brief Update myLastCreated* or myPreviewData
* \param anEditor - it contains edition results * \param anEditor - it contains edition results
*/ */
void storeResult(::SMESH_MeshEditor& anEditor); //void storeResult(::SMESH_MeshEditor& anEditor);
/*! /*!
* \brief Clear myLastCreated* or myPreviewData * \brief Clear myLastCreated* or myPreviewData
*/ */
@ -913,12 +934,19 @@ private: //!< private methods
private: //!< fields private: //!< fields
SMESH_Mesh_i* myMesh_i; SMESH_Mesh_i* myMesh_i;
SMESH_Mesh * myMesh; SMESH_Mesh * myMesh;
::SMESH_MeshEditor myEditor; ::SMESH_MeshEditor myEditor;
bool myIsPreviewMode;
MeshEditor_I::TPreviewMesh * myPreviewMesh;
::SMESH_MeshEditor * myPreviewEditor;
SMESH::MeshPreviewStruct_var myPreviewData; SMESH::MeshPreviewStruct_var myPreviewData;
bool myPreviewMode;
// temporary IDSources
struct _IDSource;
std::list< _IDSource* > myAuxIDSources;
void deleteAuxIDSources();
}; };
#endif #endif

View File

@ -483,12 +483,13 @@ int SMESH_Mesh_i::ImportSTLFile( const char* theFileName )
*/ */
//================================================================================ //================================================================================
SMESH::ComputeError* SMESH_Mesh_i::ImportGMFFile( const char* theFileName ) SMESH::ComputeError* SMESH_Mesh_i::ImportGMFFile( const char* theFileName,
bool theMakeRequiredGroups )
throw (SALOME::SALOME_Exception) throw (SALOME::SALOME_Exception)
{ {
SMESH_ComputeErrorPtr error; SMESH_ComputeErrorPtr error;
try { try {
error = _impl->GMFToMesh( theFileName ); error = _impl->GMFToMesh( theFileName, theMakeRequiredGroups );
} }
catch ( std::bad_alloc& exc ) { catch ( std::bad_alloc& exc ) {
error = SMESH_ComputeError::New( Driver_Mesh::DRS_FAIL, "std::bad_alloc raised" ); error = SMESH_ComputeError::New( Driver_Mesh::DRS_FAIL, "std::bad_alloc raised" );
@ -1064,11 +1065,11 @@ void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup
else else
aMeshEditor->RemoveElements( anIds ); aMeshEditor->RemoveElements( anIds );
// Update Python script (theGroup must be alive for this)
pyDump << _this() << ".RemoveGroupWithContents( " << theGroup << " )";
// Remove group // Remove group
RemoveGroup( theGroup ); RemoveGroup( theGroup );
// Update Python script
pyDump << _this() << ".RemoveGroupWithContents( " << theGroup << " )";
} }
//================================================================================ //================================================================================
@ -3039,7 +3040,8 @@ void SMESH_Mesh_i::ExportCGNS(::SMESH::SMESH_IDSource_ptr meshPart,
//================================================================================ //================================================================================
void SMESH_Mesh_i::ExportGMF(::SMESH::SMESH_IDSource_ptr meshPart, void SMESH_Mesh_i::ExportGMF(::SMESH::SMESH_IDSource_ptr meshPart,
const char* file) const char* file,
bool withRequiredGroups)
throw (SALOME::SALOME_Exception) throw (SALOME::SALOME_Exception)
{ {
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
@ -3049,9 +3051,12 @@ void SMESH_Mesh_i::ExportGMF(::SMESH::SMESH_IDSource_ptr meshPart,
PrepareForWriting(file,/*overwrite=*/true); PrepareForWriting(file,/*overwrite=*/true);
SMESH_MeshPartDS partDS( meshPart ); SMESH_MeshPartDS partDS( meshPart );
_impl->ExportGMF(file, &partDS); _impl->ExportGMF(file, &partDS, withRequiredGroups);
TPythonDump() << _this() << ".ExportGMF( " << meshPart<< ", r'" << file << "')"; TPythonDump() << _this() << ".ExportGMF( "
<< meshPart<< ", r'"
<< file << "', "
<< withRequiredGroups << ")";
} }
//============================================================================= //=============================================================================

View File

@ -198,7 +198,8 @@ public:
int ImportSTLFile( const char* theFileName ) int ImportSTLFile( const char* theFileName )
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
SMESH::ComputeError* ImportGMFFile( const char* theFileName ) SMESH::ComputeError* ImportGMFFile( const char* theFileName,
bool theMakeRequiredGroups)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
/*! /*!
@ -249,7 +250,8 @@ public:
const char* file, const char* file,
CORBA::Boolean overwrite) throw (SALOME::SALOME_Exception); CORBA::Boolean overwrite) throw (SALOME::SALOME_Exception);
void ExportGMF(SMESH::SMESH_IDSource_ptr meshPart, void ExportGMF(SMESH::SMESH_IDSource_ptr meshPart,
const char* file) throw (SALOME::SALOME_Exception); const char* file,
CORBA::Boolean withRequiredGroups) throw (SALOME::SALOME_Exception);
void ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart, void ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
const char* file, const char* file,

View File

@ -255,8 +255,7 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo):
def AssureGeomPublished(mesh, geom, name=''): def AssureGeomPublished(mesh, geom, name=''):
if not isinstance( geom, geompyDC.GEOM._objref_GEOM_Object ): if not isinstance( geom, geompyDC.GEOM._objref_GEOM_Object ):
return return
if not geom.IsSame( mesh.geom ) and \ if not geom.GetStudyEntry() and \
not geom.GetStudyEntry() and \
mesh.smeshpyD.GetCurrentStudy(): mesh.smeshpyD.GetCurrentStudy():
## set the study ## set the study
studyID = mesh.smeshpyD.GetCurrentStudy()._get_StudyId() studyID = mesh.smeshpyD.GetCurrentStudy()._get_StudyId()
@ -330,7 +329,6 @@ class smeshDC(SMESH._objref_SMESH_Gen):
return Mesh(self,self.geompyD,obj,name) return Mesh(self,self.geompyD,obj,name)
## Returns a long value from enumeration ## Returns a long value from enumeration
# Should be used for SMESH.FunctorType enumeration
# @ingroup l1_controls # @ingroup l1_controls
def EnumToLong(self,theItem): def EnumToLong(self,theItem):
return theItem._v return theItem._v
@ -509,7 +507,9 @@ class smeshDC(SMESH._objref_SMESH_Gen):
# @return [ an instance of Mesh class, SMESH::ComputeError ] # @return [ an instance of Mesh class, SMESH::ComputeError ]
# @ingroup l2_impexp # @ingroup l2_impexp
def CreateMeshesFromGMF( self, theFileName ): def CreateMeshesFromGMF( self, theFileName ):
aSmeshMesh, error = SMESH._objref_SMESH_Gen.CreateMeshesFromGMF(self,theFileName) aSmeshMesh, error = SMESH._objref_SMESH_Gen.CreateMeshesFromGMF(self,
theFileName,
True)
if error.comment: print "*** CreateMeshesFromGMF() errors:\n", error.comment if error.comment: print "*** CreateMeshesFromGMF() errors:\n", error.comment
return Mesh(self, self.geompyD, aSmeshMesh), error return Mesh(self, self.geompyD, aSmeshMesh), error
@ -640,9 +640,13 @@ class smeshDC(SMESH._objref_SMESH_Gen):
# Checks that Threshold is GEOM object # Checks that Threshold is GEOM object
if isinstance(aThreshold, geompyDC.GEOM._objref_GEOM_Object): if isinstance(aThreshold, geompyDC.GEOM._objref_GEOM_Object):
aCriterion.ThresholdStr = GetName(aThreshold) aCriterion.ThresholdStr = GetName(aThreshold)
aCriterion.ThresholdID = aThreshold.GetStudyEntry() aCriterion.ThresholdID = aThreshold.GetStudyEntry()
if not aCriterion.ThresholdID: if not aCriterion.ThresholdID:
raise RuntimeError, "Threshold shape must be published" name = aCriterion.ThresholdStr
if not name:
name = "%s_%s"%(aThreshold.GetShapeType(), id(aThreshold)%10000)
aCriterion.ThresholdID = self.geompyD.addToStudy( aThreshold, name )
#raise RuntimeError, "Threshold shape must be published"
else: else:
print "Error: The Threshold should be a shape." print "Error: The Threshold should be a shape."
return None return None
@ -768,6 +772,8 @@ class smeshDC(SMESH._objref_SMESH_Gen):
# @return SMESH_NumericalFunctor # @return SMESH_NumericalFunctor
# @ingroup l1_controls # @ingroup l1_controls
def GetFunctor(self,theCriterion): def GetFunctor(self,theCriterion):
if isinstance( theCriterion, SMESH._objref_NumericalFunctor ):
return theCriterion
aFilterMgr = self.CreateFilterManager() aFilterMgr = self.CreateFilterManager()
if theCriterion == FT_AspectRatio: if theCriterion == FT_AspectRatio:
return aFilterMgr.CreateAspectRatio() return aFilterMgr.CreateAspectRatio()
@ -1002,7 +1008,8 @@ class Mesh:
if not self.geom: if not self.geom:
self.geom = self.mesh.GetShapeToMesh() self.geom = self.mesh.GetShapeToMesh()
self.editor = self.mesh.GetMeshEditor() self.editor = self.mesh.GetMeshEditor()
self.functors = [None] * SMESH.FT_Undefined._v
# set self to algoCreator's # set self to algoCreator's
for attrName in dir(self): for attrName in dir(self):
@ -1224,9 +1231,13 @@ class Mesh:
elif err.state == HYP_BAD_GEOMETRY: elif err.state == HYP_BAD_GEOMETRY:
reason = ('%s %sD algorithm "%s" is assigned to mismatching' reason = ('%s %sD algorithm "%s" is assigned to mismatching'
'geometry' % ( glob, dim, name )) 'geometry' % ( glob, dim, name ))
elif err.state == HYP_HIDDEN_ALGO:
reason = ('%s %sD algorithm "%s" is ignored due to presence of a %s '
'algorithm of upper dimension generating %sD mesh'
% ( glob, dim, name, glob, dim ))
else: else:
reason = "For unknown reason."+\ reason = ("For unknown reason. "
" Revise Mesh.Compute() implementation in smeshDC.py!" "Developer, revise Mesh.Compute() implementation in smeshDC.py!")
pass pass
if allReasons != "":allReasons += "\n" if allReasons != "":allReasons += "\n"
allReasons += "- " + reason allReasons += "- " + reason
@ -1476,7 +1487,7 @@ class Mesh:
meshPart = meshPart.mesh meshPart = meshPart.mesh
elif not meshPart: elif not meshPart:
meshPart = self.mesh meshPart = self.mesh
self.mesh.ExportGMF(meshPart, f) self.mesh.ExportGMF(meshPart, f, True)
## Deprecated, used only for compatibility! Please, use ExportToMEDX() method instead. ## Deprecated, used only for compatibility! Please, use ExportToMEDX() method instead.
# Exports the mesh in a file in MED format and chooses the \a version of MED format # Exports the mesh in a file in MED format and chooses the \a version of MED format
@ -2334,6 +2345,24 @@ class Mesh:
def Add0DElement(self, IDOfNode): def Add0DElement(self, IDOfNode):
return self.editor.Add0DElement(IDOfNode) return self.editor.Add0DElement(IDOfNode)
## Create 0D elements on all nodes of the given elements except those
# nodes on which a 0D element already exists.
# @param theObject an object on whose nodes 0D elements will be created.
# It can be mesh, sub-mesh, group, list of element IDs or a holder
# of nodes IDs created by calling mesh.GetIDSource( nodes, SMESH.NODE )
# @param theGroupName optional name of a group to add 0D elements created
# and/or found on nodes of \a theObject.
# @return an object (a new group or a temporary SMESH_IDSource) holding
# IDs of new and/or found 0D elements. IDs of 0D elements
# can be retrieved from the returned object by calling GetIDs()
# @ingroup l2_modif_add
def Add0DElementsToAllNodes(self, theObject, theGroupName=""):
if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh()
if isinstance( theObject, list ):
theObject = self.GetIDSource( theObject, SMESH.ALL )
return self.editor.Create0DElementsOnAllNodes( theObject, theGroupName )
## Creates a ball element on a node with given ID. ## Creates a ball element on a node with given ID.
# @param IDOfNode the ID of node for creation of the element. # @param IDOfNode the ID of node for creation of the element.
# @param diameter the bal diameter. # @param diameter the bal diameter.
@ -2627,30 +2656,25 @@ class Mesh:
## Fuses the neighbouring triangles into quadrangles. ## Fuses the neighbouring triangles into quadrangles.
# @param IDsOfElements The triangles to be fused, # @param IDsOfElements The triangles to be fused,
# @param theCriterion is FT_...; used to choose a neighbour to fuse with. # @param theCriterion is a numerical functor, in terms of enum SMESH.FunctorType, used to
# choose a neighbour to fuse with.
# @param MaxAngle is the maximum angle between element normals at which the fusion # @param MaxAngle is the maximum angle between element normals at which the fusion
# is still performed; theMaxAngle is mesured in radians. # is still performed; theMaxAngle is mesured in radians.
# Also it could be a name of variable which defines angle in degrees. # Also it could be a name of variable which defines angle in degrees.
# @return TRUE in case of success, FALSE otherwise. # @return TRUE in case of success, FALSE otherwise.
# @ingroup l2_modif_unitetri # @ingroup l2_modif_unitetri
def TriToQuad(self, IDsOfElements, theCriterion, MaxAngle): def TriToQuad(self, IDsOfElements, theCriterion, MaxAngle):
flag = False
if isinstance(MaxAngle,str):
flag = True
MaxAngle,Parameters,hasVars = ParseAngles(MaxAngle) MaxAngle,Parameters,hasVars = ParseAngles(MaxAngle)
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if not IDsOfElements: if not IDsOfElements:
IDsOfElements = self.GetElementsId() IDsOfElements = self.GetElementsId()
Functor = 0 Functor = self.smeshpyD.GetFunctor(theCriterion)
if ( isinstance( theCriterion, SMESH._objref_NumericalFunctor ) ):
Functor = theCriterion
else:
Functor = self.smeshpyD.GetFunctor(theCriterion)
return self.editor.TriToQuad(IDsOfElements, Functor, MaxAngle) return self.editor.TriToQuad(IDsOfElements, Functor, MaxAngle)
## Fuses the neighbouring triangles of the object into quadrangles ## Fuses the neighbouring triangles of the object into quadrangles
# @param theObject is mesh, submesh or group # @param theObject is mesh, submesh or group
# @param theCriterion is FT_...; used to choose a neighbour to fuse with. # @param theCriterion is a numerical functor, in terms of enum SMESH.FunctorType, used to
# choose a neighbour to fuse with.
# @param MaxAngle a max angle between element normals at which the fusion # @param MaxAngle a max angle between element normals at which the fusion
# is still performed; theMaxAngle is mesured in radians. # is still performed; theMaxAngle is mesured in radians.
# @return TRUE in case of success, FALSE otherwise. # @return TRUE in case of success, FALSE otherwise.
@ -2658,29 +2682,42 @@ class Mesh:
def TriToQuadObject (self, theObject, theCriterion, MaxAngle): def TriToQuadObject (self, theObject, theCriterion, MaxAngle):
MaxAngle,Parameters,hasVars = ParseAngles(MaxAngle) MaxAngle,Parameters,hasVars = ParseAngles(MaxAngle)
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if ( isinstance( theObject, Mesh )): if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
return self.editor.TriToQuadObject(theObject, self.smeshpyD.GetFunctor(theCriterion), MaxAngle) Functor = self.smeshpyD.GetFunctor(theCriterion)
return self.editor.TriToQuadObject(theObject, Functor, MaxAngle)
## Splits quadrangles into triangles. ## Splits quadrangles into triangles.
#
# @param IDsOfElements the faces to be splitted. # @param IDsOfElements the faces to be splitted.
# @param theCriterion FT_...; used to choose a diagonal for splitting. # @param theCriterion is a numerical functor, in terms of enum SMESH.FunctorType, used to
# choose a diagonal for splitting. If @a theCriterion is None, which is a default
# value, then quadrangles will be split by the smallest diagonal.
# @return TRUE in case of success, FALSE otherwise. # @return TRUE in case of success, FALSE otherwise.
# @ingroup l2_modif_cutquadr # @ingroup l2_modif_cutquadr
def QuadToTri (self, IDsOfElements, theCriterion): def QuadToTri (self, IDsOfElements, theCriterion = None):
if IDsOfElements == []: if IDsOfElements == []:
IDsOfElements = self.GetElementsId() IDsOfElements = self.GetElementsId()
return self.editor.QuadToTri(IDsOfElements, self.smeshpyD.GetFunctor(theCriterion)) if theCriterion is None:
theCriterion = FT_MaxElementLength2D
Functor = self.smeshpyD.GetFunctor(theCriterion)
return self.editor.QuadToTri(IDsOfElements, Functor)
## Splits quadrangles into triangles. ## Splits quadrangles into triangles.
# @param theObject the object from which the list of elements is taken, this is mesh, submesh or group # @param theObject the object from which the list of elements is taken,
# @param theCriterion FT_...; used to choose a diagonal for splitting. # this is mesh, submesh or group
# @param theCriterion is a numerical functor, in terms of enum SMESH.FunctorType, used to
# choose a diagonal for splitting. If @a theCriterion is None, which is a default
# value, then quadrangles will be split by the smallest diagonal.
# @return TRUE in case of success, FALSE otherwise. # @return TRUE in case of success, FALSE otherwise.
# @ingroup l2_modif_cutquadr # @ingroup l2_modif_cutquadr
def QuadToTriObject (self, theObject, theCriterion): def QuadToTriObject (self, theObject, theCriterion = None):
if ( isinstance( theObject, Mesh )): if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
return self.editor.QuadToTriObject(theObject, self.smeshpyD.GetFunctor(theCriterion)) if theCriterion is None:
theCriterion = FT_MaxElementLength2D
Functor = self.smeshpyD.GetFunctor(theCriterion)
return self.editor.QuadToTriObject(theObject, Functor)
## Splits quadrangles into triangles. ## Splits quadrangles into triangles.
# @param IDsOfElements the faces to be splitted # @param IDsOfElements the faces to be splitted
@ -2693,7 +2730,8 @@ class Mesh:
return self.editor.SplitQuad(IDsOfElements, Diag13) return self.editor.SplitQuad(IDsOfElements, Diag13)
## Splits quadrangles into triangles. ## Splits quadrangles into triangles.
# @param theObject the object from which the list of elements is taken, this is mesh, submesh or group # @param theObject the object from which the list of elements is taken,
# this is mesh, submesh or group
# @param Diag13 is used to choose a diagonal for splitting. # @param Diag13 is used to choose a diagonal for splitting.
# @return TRUE in case of success, FALSE otherwise. # @return TRUE in case of success, FALSE otherwise.
# @ingroup l2_modif_cutquadr # @ingroup l2_modif_cutquadr
@ -2704,7 +2742,8 @@ class Mesh:
## Finds a better splitting of the given quadrangle. ## Finds a better splitting of the given quadrangle.
# @param IDOfQuad the ID of the quadrangle to be splitted. # @param IDOfQuad the ID of the quadrangle to be splitted.
# @param theCriterion FT_...; a criterion to choose a diagonal for splitting. # @param theCriterion is a numerical functor, in terms of enum SMESH.FunctorType, used to
# choose a diagonal for splitting.
# @return 1 if 1-3 diagonal is better, 2 if 2-4 # @return 1 if 1-3 diagonal is better, 2 if 2-4
# diagonal is better, 0 if error occurs. # diagonal is better, 0 if error occurs.
# @ingroup l2_modif_cutquadr # @ingroup l2_modif_cutquadr
@ -3641,6 +3680,10 @@ class Mesh:
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
if ( isinstance( theObject, list )): if ( isinstance( theObject, list )):
theObject = self.GetIDSource(theObject, SMESH.ALL) theObject = self.GetIDSource(theObject, SMESH.ALL)
if ( isinstance( theScaleFact, float )):
theScaleFact = [theScaleFact]
if ( isinstance( theScaleFact, int )):
theScaleFact = [ float(theScaleFact)]
self.mesh.SetParameters(thePoint.parameters) self.mesh.SetParameters(thePoint.parameters)
@ -3661,6 +3704,10 @@ class Mesh:
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
if ( isinstance( theObject, list )): if ( isinstance( theObject, list )):
theObject = self.GetIDSource(theObject,SMESH.ALL) theObject = self.GetIDSource(theObject,SMESH.ALL)
if ( isinstance( theScaleFact, float )):
theScaleFact = [theScaleFact]
if ( isinstance( theScaleFact, int )):
theScaleFact = [ float(theScaleFact)]
self.mesh.SetParameters(thePoint.parameters) self.mesh.SetParameters(thePoint.parameters)
mesh = self.editor.ScaleMakeMesh(theObject, thePoint, theScaleFact, mesh = self.editor.ScaleMakeMesh(theObject, thePoint, theScaleFact,
@ -4038,9 +4085,16 @@ class Mesh:
def CreateHoleSkin(self, radius, theShape, groupName, theNodesCoords): def CreateHoleSkin(self, radius, theShape, groupName, theNodesCoords):
return self.editor.CreateHoleSkin( radius, theShape, groupName, theNodesCoords ) return self.editor.CreateHoleSkin( radius, theShape, groupName, theNodesCoords )
def _getFunctor(self, funcType ):
fn = self.functors[ funcType._v ]
if not fn:
fn = self.smeshpyD.GetFunctor(funcType)
fn.SetMesh(self.mesh)
self.functors[ funcType._v ] = fn
return fn
def _valueFromFunctor(self, funcType, elemId): def _valueFromFunctor(self, funcType, elemId):
fn = self.smeshpyD.GetFunctor(funcType) fn = self._getFunctor( funcType )
fn.SetMesh(self.mesh)
if fn.GetElementType() == self.GetElementType(elemId, True): if fn.GetElementType() == self.GetElementType(elemId, True):
val = fn.GetValue(elemId) val = fn.GetValue(elemId)
else: else:

View File

@ -195,7 +195,7 @@ class Mesh_Algorithm:
raise RuntimeError, "Attemp to create " + algo + " algoritm on None shape" raise RuntimeError, "Attemp to create " + algo + " algoritm on None shape"
self.mesh = mesh self.mesh = mesh
name = "" name = ""
if not geom: if not geom or geom.IsSame( mesh.geom ):
self.geom = mesh.geom self.geom = mesh.geom
else: else:
self.geom = geom self.geom = geom

View File

@ -84,10 +84,12 @@
using namespace std; using namespace std;
#ifdef _DEBUG_
//#define _MY_DEBUG_ //#define _MY_DEBUG_
#endif
#if OCC_VERSION_LARGE <= 0x06050300 #if OCC_VERSION_LARGE <= 0x06050300
// workaround it required only for OCCT6.5.3 and older (see OCC22809) // workaround is required only for OCCT6.5.3 and older (see OCC22809)
#define ELLIPSOLID_WORKAROUND #define ELLIPSOLID_WORKAROUND
#endif #endif

View File

@ -58,17 +58,15 @@
#ifdef _DEBUG_ #ifdef _DEBUG_
// #define DEB_FACES
// #define DEB_GRID
// #define DUMP_VERT(msg,V) \
// { TopoDS_Vertex v = V; gp_Pnt p = BRep_Tool::Pnt(v); \
// cout << msg << "( "<< p.X()<<", "<<p.Y()<<", "<<p.Z()<<" )"<<endl;}
#endif
//#define DEB_FACES #ifndef DUMP_VERT
//#define DEB_GRID
#define DUMP_VERT(msg,V) \
// { TopoDS_Vertex v = V; gp_Pnt p = BRep_Tool::Pnt(v);\
// cout << msg << "( "<< p.X()<<", "<<p.Y()<<", "<<p.Z()<<" )"<<endl;}
#else
#define DUMP_VERT(msg,v) #define DUMP_VERT(msg,v)
#endif #endif
//================================================================================ //================================================================================
@ -715,7 +713,7 @@ bool _QuadFaceGrid::AddContinuousFace( const _QuadFaceGrid& other )
const _FaceSide& otherSide = other.GetSide( i ); const _FaceSide& otherSide = other.GetSide( i );
int iMyCommon; int iMyCommon;
if ( mySides.Contain( otherSide, &iMyCommon ) ) { if ( mySides.Contain( otherSide, &iMyCommon ) ) {
// check if normals of two faces are collinear at all vertices of a otherSide // check if normals of two faces are collinear at all vertices of an otherSide
const double angleTol = M_PI / 180. / 2.; const double angleTol = M_PI / 180. / 2.;
int iV, nbV = otherSide.NbVertices(), nbCollinear = 0; int iV, nbV = otherSide.NbVertices(), nbCollinear = 0;
for ( iV = 0; iV < nbV; ++iV ) for ( iV = 0; iV < nbV; ++iV )
@ -740,15 +738,20 @@ bool _QuadFaceGrid::AddContinuousFace( const _QuadFaceGrid& other )
myChildren.push_back( *this ); myChildren.push_back( *this );
myFace.Nullify(); myFace.Nullify();
} }
// orient new children equally
int otherBottomIndex = ( 4 + i - iMyCommon + 2 ) % 4;
if ( other.IsComplex() ) if ( other.IsComplex() )
for ( TChildIterator children = other.GetChildren(); children.more(); ) for ( TChildIterator children = other.GetChildren(); children.more(); ) {
myChildren.push_back( children.next() ); myChildren.push_back( children.next() );
else myChildren.back().SetBottomSide( myChildren.back().GetSide( otherBottomIndex ));
}
else {
myChildren.push_back( other ); myChildren.push_back( other );
myChildren.back().SetBottomSide( myChildren.back().GetSide( otherBottomIndex ));
}
myLeftBottomChild = 0; myLeftBottomChild = 0;
//int otherBottomIndex = ( 4 + i - iMyCommon + 2 ) % 4;
//myChildren.back().SetBottomSide( other.GetSide( otherBottomIndex ));
// collect vertices in mySides // collect vertices in mySides
if ( other.IsComplex() ) if ( other.IsComplex() )

View File

@ -396,6 +396,15 @@ bool StdMeshers_CompositeSegment_1D::Compute(SMESH_Mesh & aMesh,
// Create mesh // Create mesh
// compute and get nodes on extremity VERTEX'es
SMESH_subMesh* smVFirst = aMesh.GetSubMesh( VFirst );
smVFirst->SetIsAlwaysComputed( false );
smVFirst->ComputeStateEngine( SMESH_subMesh::COMPUTE );
//
SMESH_subMesh* smVLast = aMesh.GetSubMesh( VLast );
smVLast->SetIsAlwaysComputed( false );
smVLast->ComputeStateEngine( SMESH_subMesh::COMPUTE );
//
const SMDS_MeshNode * nFirst = SMESH_Algo::VertexNode( VFirst, meshDS ); const SMDS_MeshNode * nFirst = SMESH_Algo::VertexNode( VFirst, meshDS );
const SMDS_MeshNode * nLast = SMESH_Algo::VertexNode( VLast, meshDS ); const SMDS_MeshNode * nLast = SMESH_Algo::VertexNode( VLast, meshDS );
if (!nFirst) if (!nFirst)

View File

@ -66,6 +66,7 @@
#include <gp_Vec.hxx> #include <gp_Vec.hxx>
#include <numeric> #include <numeric>
#include <limits>
using namespace std; using namespace std;
@ -307,7 +308,7 @@ namespace {
if ( gr1It.Value().ShapeType() == TopAbs_FACE ) if ( gr1It.Value().ShapeType() == TopAbs_FACE )
{ {
// find a boundary edge of group1 to start from // find a boundary edge of group1 to start from
TopoDS_Shape bndEdge = StdMeshers_ProjectionUtils::GetBoundaryEdge( theGroup1, theMesh ); TopoDS_Shape bndEdge = HERE::GetBoundaryEdge( theGroup1, theMesh );
if ( bndEdge.IsNull() ) if ( bndEdge.IsNull() )
return false; return false;
@ -377,40 +378,41 @@ namespace {
*/ */
//================================================================================ //================================================================================
TopoDS_Shape getOuterEdge( const TopoDS_Shape theShape1, SMESH_Mesh& mesh ) bool getOuterEdges( const TopoDS_Shape shape,
SMESH_Mesh& mesh,
std::list< TopoDS_Edge >& allBndEdges )
{ {
TopoDS_Shape edge; if ( shape.ShapeType() == TopAbs_COMPOUND )
if ( theShape1.ShapeType() == TopAbs_COMPOUND )
{ {
TopoDS_Iterator it( theShape1 ); TopoDS_Iterator it( shape );
if ( it.Value().ShapeType() == TopAbs_FACE ) // group of FACEs if ( it.More() && it.Value().ShapeType() == TopAbs_FACE ) // group of FACEs
{ {
// look for a boundary EDGE of a group // look for a boundary EDGE of a group
edge = StdMeshers_ProjectionUtils::GetBoundaryEdge( theShape1, mesh ); StdMeshers_ProjectionUtils::GetBoundaryEdge( shape, mesh, &allBndEdges );
if ( !edge.IsNull() ) if ( !allBndEdges.empty() )
return edge; return true;
} }
} }
edge = theShape1; TopExp_Explorer expF( shape, TopAbs_FACE ), expE;
TopExp_Explorer expF( theShape1, TopAbs_FACE ), expE;
if ( expF.More() ) { if ( expF.More() ) {
for ( ; expF.More(); expF.Next() ) { for ( ; expF.More(); expF.Next() ) {
edge.Nullify();
TopoDS_Shape wire = TopoDS_Shape wire =
StdMeshers_ProjectionUtils::OuterShape( TopoDS::Face( expF.Current() ), TopAbs_WIRE ); StdMeshers_ProjectionUtils::OuterShape( TopoDS::Face( expF.Current() ), TopAbs_WIRE );
for ( expE.Init( wire, TopAbs_EDGE ); edge.IsNull() && expE.More(); expE.Next() ) for ( expE.Init( wire, TopAbs_EDGE ); expE.More(); expE.Next() )
if ( !SMESH_MesherHelper::IsClosedEdge( TopoDS::Edge( expE.Current() ))) if ( !SMESH_MesherHelper::IsClosedEdge( TopoDS::Edge( expE.Current() )))
edge = expE.Current(); allBndEdges.push_back( TopoDS::Edge( expE.Current() ));
if ( !edge.IsNull() )
break;
} }
} else if (edge.ShapeType() != TopAbs_EDGE) { // no faces
edge.Nullify();
for ( expE.Init( theShape1, TopAbs_EDGE ); edge.IsNull() && expE.More(); expE.Next() )
if ( !SMESH_MesherHelper::IsClosedEdge( TopoDS::Edge( expE.Current() )))
edge = expE.Current();
} }
return edge; else if ( shape.ShapeType() != TopAbs_EDGE) { // no faces
for ( expE.Init( shape, TopAbs_EDGE ); expE.More(); expE.Next() )
if ( !SMESH_MesherHelper::IsClosedEdge( TopoDS::Edge( expE.Current() )))
allBndEdges.push_back( TopoDS::Edge( expE.Current() ));
}
else if ( shape.ShapeType() == TopAbs_EDGE ) {
if ( !SMESH_MesherHelper::IsClosedEdge( TopoDS::Edge( shape )))
allBndEdges.push_back( TopoDS::Edge( shape ));
}
return !allBndEdges.empty();
} }
} // namespace } // namespace
@ -1175,29 +1177,64 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
// Find 2 closest vertices // Find 2 closest vertices
// get 2 linked vertices of shape 1 not belonging to an inner wire of a face // get 2 linked vertices of shape 1 not belonging to an inner wire of a face
TopoDS_Shape edge = getOuterEdge( theShape1, *theMesh1 ); std::list< TopoDS_Edge > allBndEdges1;
if ( edge.IsNull() || edge.ShapeType() != TopAbs_EDGE ) if ( !getOuterEdges( theShape1, *theMesh1, allBndEdges1 ))
RETURN_BAD_RESULT("Edge not found"); RETURN_BAD_RESULT("Edge not found");
TopExp::Vertices( TopoDS::Edge( edge.Oriented(TopAbs_FORWARD)), VV1[0], VV1[1]); std::list< TopoDS_Edge >::iterator edge1 = allBndEdges1.begin();
if ( VV1[0].IsSame( VV1[1] )) double minDist = std::numeric_limits<double>::max();
RETURN_BAD_RESULT("Only closed edges"); for ( int nbChecked=0; edge1 != allBndEdges1.end() && nbChecked++ < 10; ++edge1 )
// find vertices closest to 2 linked vertices of shape 1
for ( int i1 = 0; i1 < 2; ++i1 )
{ {
double dist2 = DBL_MAX; TopExp::Vertices( TopoDS::Edge( edge1->Oriented(TopAbs_FORWARD)), VV1[0], VV1[1]);
gp_Pnt p1 = BRep_Tool::Pnt( VV1[ i1 ]); if ( VV1[0].IsSame( VV1[1] ))
p1.Translate( vec01 ); continue;//RETURN_BAD_RESULT("Only closed edges");
p1.Scale( gc[1], scale );
for ( int i2 = 1; i2 <= vMap2.Extent(); ++i2 ) // find vertices closest to 2 linked vertices of shape 1
double dist2[2] = { 1e+100, 1e+100 };
TopoDS_Vertex edge2VV[2];
for ( int i1 = 0; i1 < 2; ++i1 )
{ {
TopoDS_Vertex V2 = TopoDS::Vertex( vMap2( i2 )); gp_Pnt p1 = BRep_Tool::Pnt( VV1[ i1 ]);
gp_Pnt p2 = BRep_Tool::Pnt ( V2 ); p1.Scale( gc[0], scale );
double d2 = p1.SquareDistance( p2 ); p1.Translate( vec01 );
if ( d2 < dist2 && !V2.IsSame( VV2[ 0 ])) { if ( !i1 ) {
VV2[ i1 ] = V2; dist2 = d2; // select a closest vertex among all ones in vMap2
for ( int i2 = 1; i2 <= vMap2.Extent(); ++i2 )
{
TopoDS_Vertex V2 = TopoDS::Vertex( vMap2( i2 ));
gp_Pnt p2 = BRep_Tool::Pnt ( V2 );
double d2 = p1.SquareDistance( p2 );
if ( d2 < dist2[ 0 ] && d2 < minDist ) {
edge2VV[ 0 ] = V2;
dist2 [ 0 ] = d2;
}
}
} }
else if ( !edge2VV[0].IsNull() ) {
// select a closest vertex among ends of edges meeting at edge2VV[0]
PShapeIteratorPtr edgeIt = SMESH_MesherHelper::GetAncestors( edge2VV[0],
*theMesh2, TopAbs_EDGE);
while ( const TopoDS_Shape* edge2 = edgeIt->next() )
for ( TopoDS_Iterator itV2( *edge2 ); itV2.More(); itV2.Next() )
{
if ( itV2.Value().IsSame( edge2VV[ 0 ])) continue;
if ( !vMap2.Contains( itV2.Value() )) continue;
TopoDS_Vertex V2 = TopoDS::Vertex( itV2.Value() );
gp_Pnt p2 = BRep_Tool::Pnt ( V2 );
double d2 = p1.SquareDistance( p2 );
if ( d2 < dist2[1] && d2 < minDist ) {
edge2VV[ 1 ] = V2;
dist2 [ 1 ] = d2;
}
}
}
}
if ( dist2[0] + dist2[1] < minDist ) {
VV2[0] = edge2VV[0];
VV2[1] = edge2VV[1];
minDist = dist2[0] + dist2[1];
if ( minDist < 1e-10 )
break;
} }
} }
@ -1248,8 +1285,13 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face& face1,
SMESH_Block::GetOrderedEdges( face2, VV2[0], edges2, nbEInW2, outer_wire_algo) ) SMESH_Block::GetOrderedEdges( face2, VV2[0], edges2, nbEInW2, outer_wire_algo) )
CONT_BAD_RESULT("Different number of wires in faces "); CONT_BAD_RESULT("Different number of wires in faces ");
if ( nbEInW1 != nbEInW2 ) if ( nbEInW1 != nbEInW2 && outer_wire_algo == 0 &&
CONT_BAD_RESULT("Different number of edges in faces: " << ( std::accumulate( nbEInW1.begin(), nbEInW1.end(), 0) !=
std::accumulate( nbEInW2.begin(), nbEInW2.end(), 0)))
RETURN_BAD_RESULT("Different number of edges in faces");
if ( nbEInW1.front() != nbEInW2.front() )
CONT_BAD_RESULT("Different number of edges in the outer wire: " <<
nbEInW1.front() << " != " << nbEInW2.front()); nbEInW1.front() << " != " << nbEInW2.front());
i_ok_wire_algo = outer_wire_algo; i_ok_wire_algo = outer_wire_algo;
@ -1300,6 +1342,7 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face& face1,
} // loop algos getting an outer wire } // loop algos getting an outer wire
// Try to orient all (if !OK) or only internal wires (issue 0020996) by UV similarity // Try to orient all (if !OK) or only internal wires (issue 0020996) by UV similarity
if (( !OK || nbEInW1.size() > 1 ) && i_ok_wire_algo > -1 ) if (( !OK || nbEInW1.size() > 1 ) && i_ok_wire_algo > -1 )
{ {
// Check that Vec(VV1[0],VV1[1]) in 2D on face1 is the same // Check that Vec(VV1[0],VV1[1]) in 2D on face1 is the same
@ -1325,44 +1368,66 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face& face1,
SMESH_Block::GetOrderedEdges( face2, VV2[0], edges2, nbEInW2, i_ok_wire_algo); SMESH_Block::GetOrderedEdges( face2, VV2[0], edges2, nbEInW2, i_ok_wire_algo);
} }
gp_XY dUV = v0f2UV.XY() - v0f1UV.XY(); // UV shift between 2 faces gp_XY dUV = v0f2UV.XY() - v0f1UV.XY(); // UV shift between 2 faces
//
// skip edges of the outer wire (if the outer wire is OK) // skip edges of the outer wire (if the outer wire is OK)
list< int >::iterator nbEInW = nbEInW1.begin(); list< int >::iterator nbE2, nbE1 = nbEInW1.begin();
list< TopoDS_Edge >::iterator edge1Beg = edges1.begin(), edge2Beg = edges2.begin(); list< TopoDS_Edge >::iterator edge2Beg, edge1Beg = edges1.begin();
if ( OK ) if ( OK ) std::advance( edge1Beg, *nbE1++ );
// reach an end of edges of a current wire1
list< TopoDS_Edge >::iterator edge2End, edge1End;
//
// find corresponding wires of face2
for ( int iW1 = OK; nbE1 != nbEInW1.end(); ++nbE1, ++iW1 ) // loop on wires of face1
{ {
for ( int i = 0; i < *nbEInW; ++i ) // reach an end of edges of a current wire1
++edge1Beg, ++edge2Beg; edge1End = edge1Beg;
++nbEInW; std::advance( edge1End, *nbE1 );
} // UV on face1 to find on face2
for ( ; nbEInW != nbEInW1.end(); ++nbEInW ) // loop on wires
{
// reach an end of edges of a current wire
list< TopoDS_Edge >::iterator edge1End = edge1Beg, edge2End = edge2Beg;
for ( int i = 0; i < *nbEInW; ++i )
++edge1End, ++edge2End;
// rotate edges2 untill coincident with edges1 in 2D
v0f1UV = BRep_Tool::Parameters( TopExp::FirstVertex(*edge1Beg,true), face1 ); v0f1UV = BRep_Tool::Parameters( TopExp::FirstVertex(*edge1Beg,true), face1 );
v1f1UV = BRep_Tool::Parameters( TopExp::LastVertex (*edge1Beg,true), face1 ); v1f1UV = BRep_Tool::Parameters( TopExp::LastVertex (*edge1Beg,true), face1 );
v0f1UV.ChangeCoord() += dUV; v0f1UV.ChangeCoord() += dUV;
v1f1UV.ChangeCoord() += dUV; v1f1UV.ChangeCoord() += dUV;
int i = *nbEInW; //
while ( --i > 0 && !sameVertexUV( *edge2Beg, face2, 0, v0f1UV, vTolUV )) // look through wires of face2
edges2.splice( edge2End, edges2, edge2Beg++ ); // move edge2Beg to place before edge2End edge2Beg = edges2.begin();
if ( sameVertexUV( *edge2Beg, face2, 0, v0f1UV, vTolUV )) nbE2 = nbEInW2.begin();
if ( OK ) std::advance( edge2Beg, *nbE2++ );
for ( int iW2 = OK; nbE2 != nbEInW2.end(); ++nbE2, ++iW2 ) // loop on wires of face2
{ {
if ( nbEInW == nbEInW1.begin() ) // reach an end of edges of a current wire2
OK = true; // OK is for the first wire edge2End = edge2Beg;
// reverse edges2 if needed std::advance( edge2End, *nbE2 );
if ( !sameVertexUV( *edge2Beg, face2, 1, v1f1UV, vTolUV )) if ( *nbE1 == *nbE2 && iW2 >= iW1 )
{ {
Reverse( edges2 , *nbEInW, distance( edges2.begin(),edge2Beg )); // rotate edge2 untill coincidence with edge1 in 2D
// set correct edge2End int i = *nbE2;
edge2End = edges2.begin(); while ( i-- > 0 && !sameVertexUV( *edge2Beg, face2, 0, v0f1UV, vTolUV ))
std::advance( edge2End, std::accumulate( nbEInW1.begin(), nbEInW, *nbEInW)); // move edge2Beg to place before edge2End
edges2.splice( edge2End, edges2, edge2Beg++ );
if ( sameVertexUV( *edge2Beg, face2, 0, v0f1UV, vTolUV ))
{
if ( iW1 == 0 ) OK = true; // OK is for the first wire
// reverse edges2 if needed
if ( !sameVertexUV( *edge2Beg, face2, 1, v1f1UV, vTolUV ))
Reverse( edges2 , *nbE2, std::distance( edges2.begin(),edge2Beg ));
// put wire2 at a right place within edges2
if ( iW1 != iW2 ) {
list< TopoDS_Edge >::iterator place2 = edges2.begin();
std::advance( place2, std::distance( edges1.begin(), edge1Beg ));
edges2.splice( place2, edges2, edge2Beg, edge2End );
// move nbE2 as well
list< int >::iterator placeNbE2 = nbEInW2.begin();
std::advance( placeNbE2, iW1 );
nbEInW2.splice( placeNbE2, nbEInW2, nbE2 );
}
break;
}
} }
// prepare to the next wire loop
edge2Beg = edge2End;
} }
// prepare to the next wire loop edge1Beg = edge1End;
edge1Beg = edge1End, edge2Beg = edge2End;
} }
} }
} }
@ -1370,7 +1435,7 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face& face1,
const int nbEdges = nbEInW1.front(); const int nbEdges = nbEInW1.front();
if ( OK && nbEdges == 2 ) if ( OK && nbEdges == 2 )
{ {
// if a wire includes 2 edges, it's impossible to associate them using // if wires include 2 edges, it's impossible to associate them using
// topological information only. Try to use length of edges for association. // topological information only. Try to use length of edges for association.
double l1[2], l2[2]; double l1[2], l2[2];
edgeIt = edges1.begin(); edgeIt = edges1.begin();
@ -2064,8 +2129,9 @@ int StdMeshers_ProjectionUtils::Count(const TopoDS_Shape& shape,
*/ */
//================================================================================ //================================================================================
TopoDS_Edge StdMeshers_ProjectionUtils::GetBoundaryEdge(const TopoDS_Shape& edgeContainer, TopoDS_Edge StdMeshers_ProjectionUtils::GetBoundaryEdge(const TopoDS_Shape& edgeContainer,
const SMESH_Mesh& mesh) const SMESH_Mesh& mesh,
std::list< TopoDS_Edge >* allBndEdges)
{ {
TopTools_IndexedMapOfShape facesOfEdgeContainer, facesNearEdge; TopTools_IndexedMapOfShape facesOfEdgeContainer, facesNearEdge;
TopExp::MapShapes( edgeContainer, TopAbs_FACE, facesOfEdgeContainer ); TopExp::MapShapes( edgeContainer, TopAbs_FACE, facesOfEdgeContainer );
@ -2080,8 +2146,12 @@ TopoDS_Edge StdMeshers_ProjectionUtils::GetBoundaryEdge(const TopoDS_Shape& edge
if ( facesOfEdgeContainer.Contains( *face )) if ( facesOfEdgeContainer.Contains( *face ))
if ( facesNearEdge.Add( *face ) && facesNearEdge.Extent() > 1 ) if ( facesNearEdge.Add( *face ) && facesNearEdge.Extent() > 1 )
break; break;
if ( facesNearEdge.Extent() == 1 ) if ( facesNearEdge.Extent() == 1 ) {
return edge; if ( allBndEdges )
allBndEdges->push_back( edge );
else
return edge;
}
} }
return TopoDS_Edge(); return TopoDS_Edge();

View File

@ -220,8 +220,9 @@ class StdMeshers_ProjectionUtils
/*! /*!
* \brief Return a boundary EDGE of edgeContainer * \brief Return a boundary EDGE of edgeContainer
*/ */
static TopoDS_Edge GetBoundaryEdge(const TopoDS_Shape& edgeContainer, static TopoDS_Edge GetBoundaryEdge(const TopoDS_Shape& edgeContainer,
const SMESH_Mesh& mesh); const SMESH_Mesh& mesh,
std::list< TopoDS_Edge >* allBndEdges = 0 );
}; };
#endif #endif

View File

@ -831,10 +831,6 @@ FaceQuadStruct* StdMeshers_Quadrangle_2D::CheckNbEdges(SMESH_Mesh & aMes
} }
if (!E1.IsNull() && !E2.IsNull() && !E3.IsNull()) if (!E1.IsNull() && !E2.IsNull() && !E3.IsNull())
{ {
if ( myProxyMesh->GetProxySubMesh( E1 ) ||
myProxyMesh->GetProxySubMesh( E2 ) ||
myProxyMesh->GetProxySubMesh( E3 ) )
quad->side.push_back(new StdMeshers_FaceSide(F, E1, &aMesh, true, quad->side.push_back(new StdMeshers_FaceSide(F, E1, &aMesh, true,
ignoreMediumNodes, myProxyMesh)); ignoreMediumNodes, myProxyMesh));
quad->side.push_back(new StdMeshers_FaceSide(F, E2, &aMesh, true, quad->side.push_back(new StdMeshers_FaceSide(F, E2, &aMesh, true,

View File

@ -560,17 +560,20 @@ void StdMeshers_Regular_1D::redistributeNearVertices (SMESH_Mesh & theM
double Um = *itU++; double Um = *itU++;
double Lm = GCPnts_AbscissaPoint::Length( theC3d, Um, *itU); double Lm = GCPnts_AbscissaPoint::Length( theC3d, Um, *itU);
double L = GCPnts_AbscissaPoint::Length( theC3d, *itU, l); double L = GCPnts_AbscissaPoint::Length( theC3d, *itU, l);
StdMeshers_Regular_1D algo( *this ); static StdMeshers_Regular_1D* auxAlgo = 0;
algo._hypType = BEG_END_LENGTH; if ( !auxAlgo ) {
algo._value[ BEG_LENGTH_IND ] = Lm; auxAlgo = new StdMeshers_Regular_1D( _gen->GetANewId(), _studyId, _gen );
algo._value[ END_LENGTH_IND ] = vertexLength; auxAlgo->_hypType = BEG_END_LENGTH;
}
auxAlgo->_value[ BEG_LENGTH_IND ] = Lm;
auxAlgo->_value[ END_LENGTH_IND ] = vertexLength;
double from = *itU, to = l; double from = *itU, to = l;
if ( isEnd1 ) { if ( isEnd1 ) {
std::swap( from, to ); std::swap( from, to );
std::swap( algo._value[ BEG_LENGTH_IND ], algo._value[ END_LENGTH_IND ]); std::swap( auxAlgo->_value[ BEG_LENGTH_IND ], auxAlgo->_value[ END_LENGTH_IND ]);
} }
list<double> params; list<double> params;
if ( algo.computeInternalParameters( theMesh, theC3d, L, from, to, params, false )) if ( auxAlgo->computeInternalParameters( theMesh, theC3d, L, from, to, params, false ))
{ {
if ( isEnd1 ) params.reverse(); if ( isEnd1 ) params.reverse();
while ( 1 + nHalf-- ) while ( 1 + nHalf-- )

View File

@ -265,6 +265,7 @@ namespace VISCOUS_3D
{ {
double _r; // radius double _r; // radius
double _k; // factor to correct node smoothed position double _k; // factor to correct node smoothed position
double _h2lenRatio; // avgNormProj / (2*avgDist)
public: public:
static _Curvature* New( double avgNormProj, double avgDist ) static _Curvature* New( double avgNormProj, double avgDist )
{ {
@ -275,10 +276,12 @@ namespace VISCOUS_3D
c->_r = avgDist * avgDist / avgNormProj; c->_r = avgDist * avgDist / avgNormProj;
c->_k = avgDist * avgDist / c->_r / c->_r; c->_k = avgDist * avgDist / c->_r / c->_r;
c->_k *= ( c->_r < 0 ? 1/1.1 : 1.1 ); // not to be too restrictive c->_k *= ( c->_r < 0 ? 1/1.1 : 1.1 ); // not to be too restrictive
c->_h2lenRatio = avgNormProj / ( avgDist + avgDist );
} }
return c; return c;
} }
double lenDelta(double len) const { return _k * ( _r + len ); } double lenDelta(double len) const { return _k * ( _r + len ); }
double lenDeltaByDist(double dist) const { return dist * _h2lenRatio; }
}; };
struct _LayerEdge; struct _LayerEdge;
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
@ -730,27 +733,30 @@ namespace
gp_XYZ dir(0,0,0); gp_XYZ dir(0,0,0);
if ( !( ok = ( edges.size() > 0 ))) return dir; if ( !( ok = ( edges.size() > 0 ))) return dir;
// get average dir of edges going fromV // get average dir of edges going fromV
gp_Vec edgeDir; gp_XYZ edgeDir;
for ( unsigned i = 0; i < edges.size(); ++i ) //if ( edges.size() > 1 )
{ for ( unsigned i = 0; i < edges.size(); ++i )
edgeDir = getEdgeDir( edges[i], fromV ); {
double size2 = edgeDir.SquareMagnitude(); edgeDir = getEdgeDir( edges[i], fromV );
if ( size2 > numeric_limits<double>::min() ) double size2 = edgeDir.SquareModulus();
edgeDir /= sqrt( size2 ); if ( size2 > numeric_limits<double>::min() )
else edgeDir /= sqrt( size2 );
ok = false; else
dir += edgeDir.XYZ(); ok = false;
} dir += edgeDir;
}
gp_XYZ fromEdgeDir = getFaceDir( F, edges[0], node, helper, ok ); gp_XYZ fromEdgeDir = getFaceDir( F, edges[0], node, helper, ok );
if ( edges.size() == 1 || dir.SquareModulus() < 1e-10) if ( edges.size() == 1 )
dir = fromEdgeDir; dir = fromEdgeDir;
else if ( dir.SquareModulus() < 0.1 ) // ~< 20 degrees
dir = fromEdgeDir + getFaceDir( F, edges[1], node, helper, ok );
else if ( dir * fromEdgeDir < 0 ) else if ( dir * fromEdgeDir < 0 )
dir *= -1; dir *= -1;
if ( ok ) if ( ok )
{ {
//dir /= edges.size(); //dir /= edges.size();
if ( cosin ) { if ( cosin ) {
double angle = edgeDir.Angle( dir ); double angle = gp_Vec( edgeDir ).Angle( dir );
*cosin = cos( angle ); *cosin = cos( angle );
} }
} }
@ -1385,7 +1391,7 @@ bool _ViscousBuilder::makeLayer(_SolidData& data)
if ( data._stepSize < 1. ) if ( data._stepSize < 1. )
data._epsilon *= data._stepSize; data._epsilon *= data._stepSize;
// Put _LayerEdge's into a vector // Put _LayerEdge's into the vector data._edges
if ( !sortEdges( data, edgesByGeom )) if ( !sortEdges( data, edgesByGeom ))
return false; return false;
@ -1709,8 +1715,8 @@ bool _ViscousBuilder::setEdgeData(_LayerEdge& edge,
} }
case SMDS_TOP_VERTEX: { case SMDS_TOP_VERTEX: {
TopoDS_Vertex V = TopoDS::Vertex( helper.GetSubShapeByNode( node, getMeshDS())); TopoDS_Vertex V = TopoDS::Vertex( helper.GetSubShapeByNode( node, getMeshDS()));
gp_Vec inFaceDir = getFaceDir( F, V, node, helper, normOK); gp_XYZ inFaceDir = getFaceDir( F, V, node, helper, normOK);
double angle = inFaceDir.Angle( edge._normal ); // [0,PI] double angle = gp_Vec( inFaceDir).Angle( edge._normal ); // [0,PI]
edge._cosin = cos( angle ); edge._cosin = cos( angle );
//cout << "Cosin on VERTEX " << edge._cosin << " node " << node->GetID() << endl; //cout << "Cosin on VERTEX " << edge._cosin << " node " << node->GetID() << endl;
break; break;
@ -2858,7 +2864,7 @@ bool _LayerEdge::FindIntersection( SMESH_ElementSearcher& searcher,
} }
if ( intFound ) if ( intFound )
{ {
if ( dist < segLen*(1.01)) if ( dist < segLen*(1.01) && dist > -(_len-segLen) )
segmentIntersected = true; segmentIntersected = true;
if ( distance > dist ) if ( distance > dist )
distance = dist, iFace = j; distance = dist, iFace = j;
@ -3061,7 +3067,8 @@ bool _LayerEdge::SmoothOnEdge(Handle(Geom_Surface)& surface,
double lenDelta = 0; double lenDelta = 0;
if ( _curvature ) if ( _curvature )
{ {
lenDelta = _curvature->lenDelta( _len ); //lenDelta = _curvature->lenDelta( _len );
lenDelta = _curvature->lenDeltaByDist( dist01 );
newPos.ChangeCoord() += _normal * lenDelta; newPos.ChangeCoord() += _normal * lenDelta;
} }

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@ MeshCut_SOURCES = \
MeshCut_CPPFLAGS = $(MED3_INCLUDES) MeshCut_CPPFLAGS = $(MED3_INCLUDES)
MeshCut_LDFLAGS = $(MED3_LIBS) $(HDF5_LIBS) MeshCut_LDFLAGS = $(MED3_LIBS_C_ONLY) $(HDF5_LIBS)
salomeplugins_PYTHON = \ salomeplugins_PYTHON = \
meshcut_plugin.py meshcut_plugin.py

View File

@ -105,7 +105,7 @@
</font> </font>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="simple"> <widget class="QWidget" name="simple">
<attribute name="title"> <attribute name="title">

View File

@ -62,10 +62,13 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
def PBHelpPressed(self): def PBHelpPressed(self):
try : try :
maDoc=os.environ['DISTENE_YAMS_DOC_PDF'] maDoc=os.environ['DISTENE_YAMS_DOC_PDF']
commande='kpdf '+maDoc except Exception:
os.system (commande)
except:
QMessageBox.warning( self, "Help unavailable", str(maDoc) + " not found") QMessageBox.warning( self, "Help unavailable", str(maDoc) + " not found")
old_ld=os.getenv("LD_LIBRARY_PATH")
command="unset LD_LIBRARY_PATH;"
command+="xdg-open "+maDoc+";"
command+="export LD_LIBRARY_PATH=%s"%old_ld
os.system(command)
def PBOKPressed(self): def PBOKPressed(self):
@ -233,7 +236,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
def prepareFichier(self): def prepareFichier(self):
self.fichierIn="/tmp/PourYam_"+str(self.num)+".mesh" self.fichierIn="/tmp/PourYam_"+str(self.num)+".mesh"
import SMESH import SMESH
self.__selectedMesh.ExportGMF(self.__selectedMesh,self.fichierIn) self.__selectedMesh.ExportGMF(self.__selectedMesh,self.fichierIn, True)
def PrepareLigneCommande(self): def PrepareLigneCommande(self):
self.commande="yams " self.commande="yams "

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Some files were not shown because too many files have changed in this diff Show More