IMP 22792: EDF 8159 SMESH: Multi-dimensional extrusion/extrusion along a path/revolution

+ Pre-open MED file to speed-up reading/writing (following 22349)
+ Clock-cursor in Display Entity dlg
+ In Filter dlg, do not perform filtering if it's not needed
+ In Group dlg, store a user-given name of a new group
+ Clock-cursor after hypothesis modif as mesh clearing can be long
+ Treat selected object right at opening of Measure dlgs
+ Allow removal of elements in a not shown mesh
+ Make filter work on a not shown mesh
+ Don't leave orphan nodes at RemoveGroupWithContents
+ Avoid crash when exporting a group + fields
This commit is contained in:
eap 2015-03-17 15:06:56 +03:00
parent 0e01b1efdf
commit 6c4a9f32ed
37 changed files with 2582 additions and 4462 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 39 KiB

BIN
doc/salome/gui/SMESH/images/revolution1.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -3,12 +3,12 @@
\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. Boundary elements around elements of dimension than the input ones. Boundary elements around generated
plus one dimension are additionally created. All created elements mesh of plus one dimension are additionally created. All created
can be automatically grouped. Extrusion can be used to create a elements can be automatically grouped. Extrusion can be used to create
\ref extrusion_struct "structured mesh from scratch". a \ref extrusion_struct "structured mesh from scratch".
\image html extrusion_box.png "If you extruded e.g. several quadrangles, you get exactly same mesh as if you meshed a geometrical box (except that the initial quadrangles can be incorrectly oriented)" \image html extrusion_box.png "If you extrude several quadrangles, you get exactly same mesh as if you meshed a geometrical box (except that the initial quadrangles can be incorrectly oriented): quadrangles and segments on boundary of generated mesh are created"
<p>Any node, segment or 2D element can be extruded. Each type of <p>Any node, segment or 2D element can be extruded. Each type of
elements is extruded into a corresponding type of result elements: elements is extruded into a corresponding type of result elements:
@ -32,7 +32,8 @@ elements is extruded into a corresponding type of result elements:
<em>"Extrusion" button</em> <em>"Extrusion" button</em>
</center> </center>
The following dialog common for node, segments and faces will appear: The following dialog, looking different depending on selected options,
will appear:
\image html extrusionalongaline1.png \image html extrusionalongaline1.png
@ -44,65 +45,72 @@ The following dialog common for node, segments and faces will appear:
<li>In this dialog: <li>In this dialog:
<ul> <ul>
<li>Select the type of elements which will be extruded (nodes, 1D or <li>Specify \b Nodes, \b Edges and \b Faces, which will be extruded, by one
2D elements).</li> of following means:
<li>Specify the IDs of the elements which will be extruded by one
following means:
<ul> <ul>
<li><b>Select the whole mesh, sub-mesh or group</b> activating this <li><b>Select the whole mesh, sub-mesh or group</b> activating this
checkbox.</li> checkbox.</li>
<li>Choose mesh elements with the mouse in the 3D Viewer. It is <li>Choose mesh elements with the mouse in the 3D Viewer. It is
possible to select a whole area with a mouse frame.</li> possible to select a whole area with a mouse frame.</li>
<li>Input the element IDs directly in <b>ID Elements</b> <li>Input the element IDs directly in <b>Node IDs</b>, <b>Edge
field. The selected elements will be highlighted in the viewer.</li> IDs</b> and <b>Face IDs</b> fields. The selected elements will
be highlighted in the viewer, if the mesh is shown there.</li>
<li>Apply Filters. <b>Set filter</b> button allows to apply a <li>Apply Filters. <b>Set filter</b> button allows to apply a
filter to the selection of elements. See more about filters in filter to the selection of elements. See more about filters in
the \ref filtering_elements "Selection filters" page.</li> the \ref filtering_elements "Selection filters" page.</li>
</ul> </ul>
</li> </li>
<li>If the <b>Extrusion to Distance</b> radio button is selected</li> <li>If the <b>Extrusion to Distance</b> radio button is selected
<ul> - specify the translation vector by which the elements will be extruded.
<li>specify the translation vector by which the elements will be extruded.</li> </li>
</ul> <li>If the <b>Extrusion Along Vector</b> radio button is selected
<li>If the <b>Extrusion Along Vector</b> radio button is selected</li> <ul>
<ul> <li>specify the coordinates of the \b Vector along which the elements
<li>specify the coordinates of the \b Vector along which the elements will be extruded, either directly or by selecting the mesh face (the
will be extruded, or select the face (the normal to the face will normal to the face will define the vector),</li>
define the vector),</li> <li>specify the \b Distance of extrusion along the vector (it can
<li>specify the \b Distance of extrusion along the vector (it can be negative).</li>
be negative).</li> </ul>
</ul> </li>
<li>If the <b>Extrusion By Normal</b> radio button is selected, <li>If the <b>Extrusion By Normal</b> radio button is selected,
which is visible in \b 2D mode only, every node of selected every node of selected faces is extruded along the \a average
elements is extruded along the \a average of the \a normal vectors to of the \a normal vectors to the faces sharing the node. (Nodes and
the faces sharing the node.</li> edges can't be extruded in this mode.)
<ul> <ul>
<li>Specify the \b Distance of extrusion (it can be negative),</li> <li>Specify the \b Distance of extrusion (it can be negative),</li>
<li>Use <b>Along average normal</b> check-box to specify along <li>Use <b>Along average normal</b> check-box to specify along
what vector the distance is measured. If it is \a activated the what vector the distance is measured.
distance is measured along the average normal mentioned <ul>
above. If it is \a deactivated every node is extruded along the <li>If it is \a activated the distance is measured along the
average normal till its intersection with the virtual plane got average normal mentioned above. </li>
by translation of the face sharing the node along its own normal <li>If it is \a deactivated every node is extruded along the
by the distance. <br> average normal till its intersection with the virtual plane got
The picture below shows a cross-section of a 2D mesh extruded by translation of the face sharing the node along its own normal
with <b>Along average normal</b> activated (to the left) and by the \b Distance.</li>
deactivated (to the right). </ul>
The picture below shows a cross-section of a 2D mesh extruded
with <b>Along average normal</b> activated (to the left) and
deactivated (to the right).
\image html extrusionbynormal_alongavgnorm.png \image html extrusionbynormal_alongavgnorm.png "'Along average normal' activated (to the left) and deactivated (to the right)"
<p></li> <p></li>
<li>Using <b>Use only input elements</b> check-box to specify what
elements to use to compute the average normal. If it is \a
activated only selected faces, among faces sharing the node,
are used to compute the average normal at the node. Else all
faces sharing the node are used. <br>
The picture below shows a cross-section of a 2D mesh the upper
plane of which is extruded with <b>Use only input elements</b>
activated (to the left) and deactivated (to the right).
\image html extrusionbynormal_useonly.png <li>Using <b>Use only input elements</b> check-box specify what
<p></li> elements to use to compute the average normal.<ul>
<li> If it is \a activated only selected faces, among faces
sharing the node, are used to compute the average normal at
the node. </li>
<li>Else all faces sharing the node are used.</li></ul>
The picture below shows a cross-section of a 2D mesh the upper
plane of which is extruded with <b>Use only input elements</b>
activated (to the left) and deactivated (to the right).
\image html extrusionbynormal_useonly.png "'Use only input elements' activated (to the left) and deactivated (to the right)"
<p></li>
</li>
</ul> </ul>
<li>Specify the <b>Number of steps</b>.</li> <li>Specify the <b>Number of steps</b>.</li>
<li>If you activate <b>Generate Groups</b> check-box, the <em>result elements</em> <li>If you activate <b>Generate Groups</b> check-box, the <em>result elements</em>
created from <em>selected elements</em> contained in groups will be created from <em>selected elements</em> contained in groups will be
@ -120,6 +128,8 @@ The following dialog common for node, segments and faces will appear:
<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>
</ol> </ol>
<p>
\anchor extrusion_struct \anchor extrusion_struct
<h2>Example: creation of a structured mesh from scratch</h2> <h2>Example: creation of a structured mesh from scratch</h2>

View File

@ -3,7 +3,7 @@
\page extrusion_along_path_page Extrusion along Path \page extrusion_along_path_page Extrusion along Path
\n In principle, <b>Extrusion along Path</b> works in the same way \n In principle, <b>Extrusion along Path</b> works in the same way
as \b Extrusion, the main difference is that we define not a vector, as \ref extrusion_page "Extrusion", the main difference is that we define not a vector,
but a path of extrusion which must be a 1D mesh or 1D sub-mesh. but a path of extrusion which must be a 1D mesh or 1D sub-mesh.
To get an idea of how this algorithm works, examine several examples, To get an idea of how this algorithm works, examine several examples,
starting from the most simple case of extrusion along a straight edge. starting from the most simple case of extrusion along a straight edge.
@ -77,75 +77,93 @@ path</b> item or click <em>"Extrusion along a path"</em> button in the toolbar.
\image html image101.png \image html image101.png
<center><em>"Extrusion along a path" button</em></center> <center><em>"Extrusion along a path" button</em></center>
The following dialog common for line and planar elements will appear: The following dialog will appear:
\image html extrusion_along_path_dlg.png \image html extrusion_along_path_dlg.png
</li> </li>
<li>In this dialog: <li>In this dialog:
<ul> <ul>
<li>select the type of elements which will be extruded (1D or 2D),</li> <li>Use \a Selection button to specify what you are going to
<li>specify the <b>IDs of the elements</b> which will be extruded select at a given moment, \b Nodes, \b Edges or \b Faces.
\image html image120.png
<ul> <center><em>"Selection" button</em></center>
<li><b>Select the whole mesh, sub-mesh or group</b> activating the corresponding check-box; or</li> </li>
<li>Choose mesh elements with the mouse in the 3D Viewer. It is <li>Specify \b Nodes, \b Edges and \b Faces, which will be extruded, by one
possible to select a whole area with a mouse frame; or</li> of following means:
<li>Input the element IDs directly in <b>ID Elements</b> field. The selected elements will be highlighted in the <ul>
viewer; or</li> <li><b>Select the whole mesh, sub-mesh or group</b> activating this
<li>apply Filters. <b>Set filter</b> button allows to apply a filter to the selection of elements. See more checkbox.</li>
about filters in the \ref selection_filter_library_page "Selection filter library" page.</li> <li>Choose mesh elements with the mouse in the 3D Viewer. It is
</ul> possible to select a whole area with a mouse frame.</li>
<li>Input the element IDs directly in <b>Node IDs</b>, <b>Edge
</li> IDs</b> and <b>Face IDs</b> fields. The selected elements will
<li>Define the \b Path along which the elements will be extruded.<br> be highlighted in the viewer, if the mesh is shown there.</li>
Path definition consists of several elements: <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><b>Mesh or submesh</b> - 1D mesh or sub-mesh, along which proceeds the extrusion</li> the \ref filtering_elements "Selection filters" page.</li>
<li><b>Start node</b> - the start node. It is used to define the direction of extrusion </li> </ul>
</ul> </li>
</li> <li>Define the \b Path along which the elements will be extruded.<br>
<li>Activate <b>Generate Groups</b> check-box if it is necessary to copy the groups of Path definition consists of several elements:
elements of the source mesh to the newly created one. </li> <ul>
<li><b>Mesh or submesh</b> - 1D mesh or sub-mesh, along which
proceeds the extrusion.</li>
<li><b>Start node</b> - the start node. It is used to define
the direction of extrusion. </li>
</ul>
</li>
<li>If you activate <b>Generate Groups</b> check-box, the <em>result elements</em>
created from <em>selected elements</em> contained in groups will be
included into new groups named by pattern "<old group
name>_extruded" and "<old group name>_top". For example if a
selected quadrangle is included in \a g_Faces group (see figures
below) then result hexahedra will be included in \a
g_Faces_extruded group and a quadrangle created at the "top" of
extruded mesh will be included in \a g_Faces_top group. <br>
\image html extrusion_groups.png
\image html extrusion_groups_res.png
<p> This check-box is active only if there are some groups in the mesh.
</li>
</ul> </ul>
</li> </li>
<li>There are two optional parameters, which can be very useful: <li>There are two optional parameters, which can be very useful:
<ul> <ul>
<li>If the path of extrusion is curvilinear, at each iteration the <li>If the path of extrusion is curvilinear, at each iteration the
extruded elements are rotated to keep its initial angularity to the extruded elements are rotated to keep its initial angularity to the
curve. By default, the <b>Base Point</b> around which the elements are rotated is curve. By default, the <b>Base Point</b> around which the elements
the mass center of the elements, however, you can specify any point as are rotated is the mass center of the elements, however, you can
the <b>Base Point</b> and the elements will be rotated with respect to this specify any point as the <b>Base Point</b> and the elements will be
point.<br> rotated with respect to this point.<br>
Note that only the displacement of the <b>Base Point</b> exactly equals to the Note that only the displacement of the <b>Base Point</b> exactly
path, and all other extruded elements simply keep their position relatively to the <b>Base Point</b> at each iteration. equals to the path, and all other extruded elements simply keep
</li> their position relatively to the <b>Base Point</b> at each
<li>The elements can also be rotated around the path to get the resulting iteration.</li>
mesh in a helical fashion. You can set the values of angles at the <li>The elements can also be rotated around the path to get the
right, add them to the list of angles at the left by pressing the <em>"Add"</em> resulting mesh in a helical fashion. You can set the values of
button and remove them from the list by pressing the <em>"Remove"</em> button. angles at the right, add them to the list of angles at the left by
pressing the <em>"Add"</em> button and remove them from the list by
pressing the <em>"Remove"</em> button.
\image html add.png \image html add.png
<center><em>"Add" button</em></center> <center><em>"Add" button</em></center>
\image html remove.png \image html remove.png
<center><em>"Remove" button</em></center> <center><em>"Remove" button</em></center>
<b>Linear variation of the angles</b> option allows defining the angle of gradual rotation for the whole path. <b>Linear variation of the angles</b> option allows defining the angle
At each step the elements will be rotated by <code>angle / nb. of steps</code>. of gradual rotation for the whole path. At each step the elements will
be rotated by <code>angle / nb. of steps</code>.
</li> </li>
</ul> </ul>
</li> </li>
<li>Click \b Apply or <b> Apply and Close</b> button to confirm the operation. <li>Click \b Apply or <b> Apply and Close</b> button to confirm the
Mesh edges will be extruded into operation. Mesh edges will be extruded into faces, faces into
faces, faces into volumes. The external surface of the resulting 3d volumes. The external surface of the resulting 3d mesh (if faces
mesh (if faces have been extruded) is covered with faces, and corners have been extruded) is covered with faces, and corners with
with edges. If the path is closed, the resulting mesh can contain edges. If the path is closed, the resulting mesh can contain
duplicated nodes and faces, because no sewing is done. duplicated nodes and faces, because no sewing is done.
</li> </li>
</ol> </ol>

View File

@ -2,16 +2,16 @@
\page revolution_page Revolution \page revolution_page Revolution
\n Revolution is a type of surface meshing by generation from \n Revolution is used to build mesh elements of plus one
discretized lines. It is used to build mesh elements of plus one dimension than the input ones. Boundary elements around generated
dimension than the swept ones. Each swept 1D element produces one or mesh of plus one dimension are additionally created. All created
more quadrangles (or triangles if one node of a rotated element lays elements can be automatically grouped. Revolution can be used to create
on the revolution axis). a \ref extrusion_struct "structured mesh from scratch".
<em>To apply revolution:</em> <em>To apply revolution:</em>
<ol> <ol>
<li>From the \b Modification menu choose the \b Revolution item or click <li>From the \b Modification menu choose the \b Revolution item or click
<em>"Revolution"</em> button in the toolbar. <em>"Revolution"</em> button in the toolbar.
\image html image92.png \image html image92.png
<center><em>"Revolution" button</em></center> <center><em>"Revolution" button</em></center>
@ -20,65 +20,91 @@ The following dialog common for line and planar elements will appear:
\image html revolution1.png \image html revolution1.png
</li> </li>
<li>
In this dialog you should specify:
<ul>
<li>the type of elements which will be extruded (1D or 2D),</li>
<li>specify the IDs of the elements which will be revolved:
<ul>
<li><b>Select the whole mesh, submesh or group</b> activating this
checkbox; or</li>
<li>choose mesh elements with the mouse in the 3D Viewer. It is
possible to select a whole area with a mouse frame; or</li>
<li>input the element IDs directly in <b>ID Elements</b> field. The selected elements will be highlighted in the
viewer; or</li>
<li>apply Filters. <b>Set filter</b> button allows to apply a filter to the selection of elements. See more
about filters in the \ref selection_filter_library_page "Selection filter library" page.</li>
</ul>
</li>
<li>specify the axis of revolution:
<ul>
<li>specify the cooordinates of the start \b Point of the vector of revolution;</li>
<li>specify the \b Vector of revolution through the coordinates of its
end point with respect to the coordinates of the start
point. Alternatively, it is possible to specify the vector through the
normal to the selected face.</li>
</ul>
</li>
<li>specify the angle of revolution and the number of revolution steps,</li>
<ul> <li> Angle by Step - the elements are extruded by the specified angle at each step (i.e. for Angle=30 and Number of Steps=2, the elements will be extruded
by 30 degrees twice for a total of 30*2=60)</li>
<li>In this dialog:
<ul>
<li>Use \a Selection button to specify what you are going to
select at a given moment, \b Nodes, \b Edges or \b Faces.
\image html image120.png
<center><em>"Selection" button</em></center>
</li>
<li>Specify \b Nodes, \b Edges and \b Faces, which will be revolved, by one
of following means:
<ul>
<li><b>Select the whole mesh, sub-mesh or group</b> activating this
checkbox.</li>
<li>Choose mesh elements with the mouse in the 3D Viewer. It is
possible to select a whole area with a mouse frame.</li>
<li>Input the element IDs directly in <b>Node IDs</b>, <b>Edge
IDs</b> and <b>Face IDs</b> fields. The selected elements will
be highlighted in the viewer, if the mesh is shown there.</li>
<li>Apply Filters. <b>Set filter</b> button allows to apply a
filter to the selection of elements. See more about filters in
the \ref filtering_elements "Selection filters" page.</li>
</ul>
</li>
<li>Specify the \b Axis of revolution:
<ul>
<li>Specify the cooordinates of the start \b Point of the
axis of revolution; either directly or by picking a node
in the Viewer (selection of nodes is activated as you click
the \a Selection button).</li>
<li>Specify the \b Vector of the axis in either of three ways:
<ul>
<li>directly adjust vector components;</li>
<li>click \a Selection button, chose <em>From Origin to
selected Point</em> in the opened menu and pick a node
in the Viewer; </li>
<li>click \a Selection button, chose <em>Normal to
selected Face</em> in the opened menu and pick a mesh
face in the Viewer.</li>
</ul></ul>
</li>
<li>Specify the \b Angle of revolution and the <b>Number of
steps </b> of revolution,
<ul>
<li> <b>Angle by Step</b> - the elements are revolved by the
specified angle at each step (i.e. for Angle=30 and Number of
Steps=2, the elements will be extruded by 30 degrees twice for a
total of 30*2=60)
\image html revolutionsn2.png "Example of Revolution with Angle by Step" \image html revolutionsn2.png "Example of Revolution with Angle by Step"
</li>
<li> Total Angle - the elements are extruded by the specified angle only once and the number of steps defines the number of iterations <li> <b>Total Angle</b> - the elements are revolved by the
(i.e.for Angle=30 and Number of Steps=2, the elements will be extruded by 30/2=15 degrees twice for a total of 30). </li> specified angle only once and the number of steps defines the
number of iterations (i.e. for Angle=30 and Number of Steps=2,
the elements will be revolved by 30/2=15 degrees twice for a
total of 30).
\image html revolutionsn1.png "Example of Revolution with Total Angle" \image html revolutionsn1.png "Example of Revolution with Total Angle"
</li>
</ul>
</li>
<li>Specify the \b Tolerance for the operation, which is used to
detect nodes lying on the axis of revolution.
</li>
<li>Activate <b>Preview</b> check-box to see the result mesh in
the viewer.
</li>
<li>If you activate <b>Generate Groups</b> check-box, the <em>result elements</em>
created from <em>selected elements</em> contained in groups will be
included into new groups named by pattern "<old group
name>_rotated" and "<old group name>_top". For example if a
selected quadrangle is included in \a g_Faces group (see figures
below) then result hexahedra will be included in \a
g_Faces_rotated group and a quadrangle created at the "top" of
revolved mesh will be included in \a g_Faces_top group. <br>
\image html extrusion_groups.png
\image html extrusion_groups_res.png
<p> This check-box is active only if there are some groups in the mesh.
</li>
</ul>
</li>
</ul> <li>Click \b Apply or <b> Apply and Close</b> button to confirm the
</li> operation.</li>
<li>specify the tolerance for the operation</li>
<li>activate <b>Preview</b> checkbox to show the parameter-setting in the viewer </li>
<li>activate <b>Generate Groups</b> checkbox to copy the groups of
elements of the source mesh to the newly created one. </li>
</li>
</ul>
<li>Click \b Apply or <b> Apply and Close</b> button to confirm the
operation.</li>
</ol> </ol>
<br><b>See Also</b> a sample TUI Script of a
<br><b>See Also</b> a sample TUI Script of a
\ref tui_revolution "Revolution" operation. \ref tui_revolution "Revolution" operation.
*/ */

View File

@ -40,20 +40,20 @@ module SMESH
{ {
/*! /*!
* Return data of mesh edition preview which is computed provided * Return data of mesh edition preview which is computed provided
* that the editor was obtained trough SMESH_Mesh::GetMeshEditPreviewer() * that the editor was obtained through SMESH_Mesh::GetMeshEditPreviewer()
*/ */
MeshPreviewStruct GetPreviewData() raises (SALOME::SALOME_Exception); MeshPreviewStruct GetPreviewData() raises (SALOME::SALOME_Exception);
/*! /*!
* If during last operation of MeshEditor some nodes were * If during last operation of MeshEditor some nodes were
* created this method returns list of their IDs, if new nodes * created, this method returns list of their IDs, if new nodes
* not created - returns empty list * not created - returns empty list
*/ */
long_array GetLastCreatedNodes() raises (SALOME::SALOME_Exception); long_array GetLastCreatedNodes() raises (SALOME::SALOME_Exception);
/*! /*!
* If during last operation of MeshEditor some elements were * If during last operation of MeshEditor some elements were
* created this method returns list of their IDs, if new elements * created, this method returns list of their IDs, if new elements
* not created - returns empty list * not created - returns empty list
*/ */
long_array GetLastCreatedElems() raises (SALOME::SALOME_Exception); long_array GetLastCreatedElems() raises (SALOME::SALOME_Exception);
@ -393,7 +393,7 @@ module SMESH
void ConvertFromQuadraticObject(in SMESH_IDSource theObject) void ConvertFromQuadraticObject(in SMESH_IDSource theObject)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
void ConvertToBiQuadratic(in boolean theForce3d, void ConvertToBiQuadratic(in boolean theForce3d,
in SMESH_IDSource theObject) in SMESH_IDSource theObject)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
@ -402,198 +402,73 @@ module SMESH
void RenumberElements() raises (SALOME::SALOME_Exception); void RenumberElements() raises (SALOME::SALOME_Exception);
/*! /*!
* \brief Genarate dim+1 elements by rotation of given elements around axis * \brief Generate dim+1 elements by rotation of the object around axis
* \param IDsOfElements - elements to ratate * \param Nodes - nodes to revolve: a list including groups, sub-meshes or a mesh
* \param Axix - rotation axis * \param Edges - edges to revolve: a list including groups, sub-meshes or a mesh
* \param AngleInRadians - rotation angle * \param Faces - faces to revolve: a list including groups, sub-meshes or a mesh
* \param NbOfSteps - number of elements to generate from one element * \param Axis - rotation axis
* \param AngleInRadians - rotation angle
* \param NbOfSteps - number of elements to generate from one element
* \param ToMakeGroups - if true, new elements will be included into new groups
* corresponding to groups the input elements included in.
* \return ListOfGroups - new groups craeted if \a ToMakeGroups is true
*/ */
void RotationSweep(in long_array IDsOfElements, ListOfGroups RotationSweepObjects(in ListOfIDSources Nodes,
in AxisStruct Axix, in ListOfIDSources Edges,
in double AngleInRadians, in ListOfIDSources Faces,
in long NbOfSteps, in AxisStruct Axis,
in double Tolerance) in double AngleInRadians,
raises (SALOME::SALOME_Exception); in long NbOfSteps,
/*! in double Tolerance,
* \brief Same as previous but additionally create groups of elements in boolean ToMakeGroups)
* generated from elements belonging to preexisting groups
*/
ListOfGroups RotationSweepMakeGroups(in long_array IDsOfElements,
in AxisStruct Axix,
in double AngleInRadians,
in long NbOfSteps,
in double Tolerance)
raises (SALOME::SALOME_Exception);
/*!
* \brief Genarate dim+1 elements by rotation of the object around axis
* \param theObject - object containing elements to ratate
* \param Axix - rotation axis
* \param AngleInRadians - rotation angle
* \param NbOfSteps - number of elements to generate from one element
*/
void RotationSweepObject(in SMESH_IDSource theObject,
in AxisStruct Axix,
in double AngleInRadians,
in long NbOfSteps,
in double Tolerance)
raises (SALOME::SALOME_Exception);
/*!
* \brief Same as previous but additionally create groups of elements
* generated from elements belonging to preexisting groups
*/
ListOfGroups RotationSweepObjectMakeGroups(in SMESH_IDSource theObject,
in AxisStruct Axix,
in double AngleInRadians,
in long NbOfSteps,
in double Tolerance)
raises (SALOME::SALOME_Exception);
/*!
* \brief Genarate dim+1 elements by rotation of the object around axis
* \param theObject - object containing elements to ratate
* \param Axix - rotation axis
* \param AngleInRadians - rotation angle
* \param NbOfSteps - number of elements to generate from one element
*/
void RotationSweepObject1D(in SMESH_IDSource theObject,
in AxisStruct Axix,
in double AngleInRadians,
in long NbOfSteps,
in double Tolerance)
raises (SALOME::SALOME_Exception);
/*!
* \brief Same as previous but additionally create groups of elements
* generated from elements belonging to preexisting groups
*/
ListOfGroups RotationSweepObject1DMakeGroups(in SMESH_IDSource theObject,
in AxisStruct Axix,
in double AngleInRadians,
in long NbOfSteps,
in double Tolerance)
raises (SALOME::SALOME_Exception);
/*!
* \brief Genarate dim+1 elements by rotation of the object around axis
* \param theObject - object containing elements to ratate
* \param Axix - rotation axis
* \param AngleInRadians - rotation angle
* \param NbOfSteps - number of elements to generate from one element
*/
void RotationSweepObject2D(in SMESH_IDSource theObject,
in AxisStruct Axix,
in double AngleInRadians,
in long NbOfSteps,
in double Tolerance)
raises (SALOME::SALOME_Exception);
/*!
* \brief Same as previous but additionally create groups of elements
* generated from elements belonging to preexisting groups
*/
ListOfGroups RotationSweepObject2DMakeGroups(in SMESH_IDSource theObject,
in AxisStruct Axix,
in double AngleInRadians,
in long NbOfSteps,
in double Tolerance)
raises (SALOME::SALOME_Exception);
/*!
* \brief Genarate dim+1 elements by extrusion of elements along vector
* \param IDsOfElements - elements to sweep
* \param StepVector - vector giving direction and distance of an extrusion step
* \param NbOfSteps - number of elements to generate from one element
*/
void ExtrusionSweep(in long_array IDsOfElements,
in DirStruct StepVector,
in long NbOfSteps)
raises (SALOME::SALOME_Exception);
/*!
* \brief Genarate dim+1 elements by extrusion of elements along vector
* \param IDsOfElements - elements to sweep
* \param StepVector - vector giving direction and distance of an extrusion step
* \param NbOfSteps - number of elements to generate from one element
*/
void ExtrusionSweep0D(in long_array IDsOfElements,
in DirStruct StepVector,
in long NbOfSteps)
raises (SALOME::SALOME_Exception);
/*!
* \brief Same as previous but additionally create groups of elements
* generated from elements belonging to preexisting groups
*/
ListOfGroups ExtrusionSweepMakeGroups(in long_array IDsOfElements,
in DirStruct StepVector,
in long NbOfSteps)
raises (SALOME::SALOME_Exception);
/*!
* \brief Same as previous but elements are nodes
*/
ListOfGroups ExtrusionSweepMakeGroups0D(in long_array IDsOfElements,
in DirStruct StepVector,
in long NbOfSteps)
raises (SALOME::SALOME_Exception);
/*!
* Generate new elements by extrusion of theElements
* by StepVector by NbOfSteps
* param ExtrFlags set flags for performing extrusion
* param SewTolerance - uses for comparing locations of nodes if flag
* EXTRUSION_FLAG_SEW is set
*/
void AdvancedExtrusion(in long_array IDsOfElements,
in DirStruct StepVector,
in long NbOfSteps,
in long ExtrFlags,
in double SewTolerance)
raises (SALOME::SALOME_Exception);
/*!
* \brief Same as previous but additionally create groups of elements
* generated from elements belonging to preexisting groups
*/
ListOfGroups AdvancedExtrusionMakeGroups(in long_array IDsOfElements,
in DirStruct StepVector,
in long NbOfSteps,
in long ExtrFlags,
in double SewTolerance)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
void ExtrusionSweepObject(in SMESH_IDSource theObject, /*!
in DirStruct StepVector, * \brief Generate dim+1 elements by extrusion of elements along vector
in long NbOfSteps) * \param nodes - nodes to extrude: a list including groups, sub-meshes or a mesh
raises (SALOME::SALOME_Exception); * \param edges - edges to extrude: a list including groups, sub-meshes or a mesh
ListOfGroups ExtrusionSweepObjectMakeGroups(in SMESH_IDSource theObject, * \param faces - faces to extrude: a list including groups, sub-meshes or a mesh
in DirStruct StepVector, * \param stepVector - vector giving direction and distance of an extrusion step
in long NbOfSteps) * \param nbOfSteps - number of elements to generate from one element
* \param toMakeGroups - if true, new elements will be included into new groups
* corresponding to groups the input elements included in.
* \return ListOfGroups - new groups craeted if \a toMakeGroups is true
*/
ListOfGroups ExtrusionSweepObjects(in ListOfIDSources nodes,
in ListOfIDSources edges,
in ListOfIDSources faces,
in DirStruct stepVector,
in long nbOfSteps,
in boolean toMakeGroups)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
void ExtrusionSweepObject0D(in SMESH_IDSource theObject, /*! Generates new elements by extrusion along the normal to a discretized surface or wire
in DirStruct StepVector, */
in long NbOfSteps) ListOfGroups ExtrusionByNormal(in ListOfIDSources theObjects,
raises (SALOME::SALOME_Exception); in double stepSize,
ListOfGroups ExtrusionSweepObject0DMakeGroups(in SMESH_IDSource theObject, in long nbOfSteps,
in DirStruct StepVector, in boolean byAverageNormal,
in long NbOfSteps) in boolean useInputElemsOnly,
in boolean makeGroups,
in short dim)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
void ExtrusionSweepObject1D(in SMESH_IDSource theObject, /*!
in DirStruct StepVector, * Generate new elements by extrusion of theElements
in long NbOfSteps) * by StepVector by NbOfSteps
raises (SALOME::SALOME_Exception); * \param ExtrFlags set flags for performing extrusion
ListOfGroups ExtrusionSweepObject1DMakeGroups(in SMESH_IDSource theObject, * \param SewTolerance - uses for comparing locations of nodes if flag
in DirStruct StepVector, * EXTRUSION_FLAG_SEW is set
in long NbOfSteps) * \param ToMakeGroups - if true, new elements will be included into new groups
raises (SALOME::SALOME_Exception); * corresponding to groups the input elements included in.
* \return ListOfGroups - new groups craeted if \a ToMakeGroups is true
void ExtrusionSweepObject2D(in SMESH_IDSource theObject, */
in DirStruct StepVector, ListOfGroups AdvancedExtrusion(in long_array IDsOfElements,
in long NbOfSteps) in DirStruct StepVector,
raises (SALOME::SALOME_Exception); in long NbOfSteps,
ListOfGroups ExtrusionSweepObject2DMakeGroups(in SMESH_IDSource theObject, in long ExtrFlags,
in DirStruct StepVector, in double SewTolerance,
in long NbOfSteps) in boolean ToMakeGroups)
raises (SALOME::SALOME_Exception);
ListOfGroups ExtrusionByNormal(in SMESH_IDSource theObject,
in double stepSize,
in long nbOfSteps,
in boolean byAverageNormal,
in boolean useInputElemsOnly,
in boolean makeGroups,
in short dim)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
enum Extrusion_Error { enum Extrusion_Error {
@ -604,112 +479,21 @@ module SMESH
EXTR_BAD_STARTING_NODE, EXTR_BAD_STARTING_NODE,
EXTR_BAD_ANGLES_NUMBER, EXTR_BAD_ANGLES_NUMBER,
EXTR_CANT_GET_TANGENT EXTR_CANT_GET_TANGENT
}; };
ListOfGroups ExtrusionAlongPathX(in long_array IDsOfElements, ListOfGroups ExtrusionAlongPathObjects(in ListOfIDSources Nodes,
in SMESH_IDSource Path, in ListOfIDSources Edges,
in long NodeStart, in ListOfIDSources Faces,
in boolean HasAngles, in SMESH_IDSource Path,
in double_array Angles, in GEOM::GEOM_Object PathShape,
in boolean LinearVariation, in long NodeStart,
in boolean HasRefPoint, in boolean HasAngles,
in PointStruct RefPoint, in double_array Angles,
in boolean MakeGroups, in boolean LinearVariation,
in ElementType ElemType, in boolean HasRefPoint,
out Extrusion_Error Error) in PointStruct RefPoint,
raises (SALOME::SALOME_Exception); in boolean MakeGroups,
out Extrusion_Error Error)
ListOfGroups ExtrusionAlongPathObjX(in SMESH_IDSource theObject,
in SMESH_IDSource Path,
in long NodeStart,
in boolean HasAngles,
in double_array Angles,
in boolean LinearVariation,
in boolean HasRefPoint,
in PointStruct RefPoint,
in boolean MakeGroups,
in ElementType ElemType,
out Extrusion_Error Error)
raises (SALOME::SALOME_Exception);
Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements,
in SMESH_Mesh PathMesh,
in GEOM::GEOM_Object PathShape,
in long NodeStart,
in boolean HasAngles,
in double_array Angles,
in boolean HasRefPoint,
in PointStruct RefPoint)
raises (SALOME::SALOME_Exception);
ListOfGroups ExtrusionAlongPathMakeGroups(in long_array IDsOfElements,
in SMESH_Mesh PathMesh,
in GEOM::GEOM_Object PathShape,
in long NodeStart,
in boolean HasAngles,
in double_array Angles,
in boolean HasRefPoint,
in PointStruct RefPoint,
out Extrusion_Error Error)
raises (SALOME::SALOME_Exception);
Extrusion_Error ExtrusionAlongPathObject(in SMESH_IDSource theObject,
in SMESH_Mesh PathMesh,
in GEOM::GEOM_Object PathShape,
in long NodeStart,
in boolean HasAngles,
in double_array Angles,
in boolean HasRefPoint,
in PointStruct RefPoint)
raises (SALOME::SALOME_Exception);
ListOfGroups ExtrusionAlongPathObjectMakeGroups(in SMESH_IDSource theObject,
in SMESH_Mesh PathMesh,
in GEOM::GEOM_Object PathShape,
in long NodeStart,
in boolean HasAngles,
in double_array Angles,
in boolean HasRefPoint,
in PointStruct RefPoint,
out Extrusion_Error Error)
raises (SALOME::SALOME_Exception);
Extrusion_Error ExtrusionAlongPathObject1D(in SMESH_IDSource theObject,
in SMESH_Mesh PathMesh,
in GEOM::GEOM_Object PathShape,
in long NodeStart,
in boolean HasAngles,
in double_array Angles,
in boolean HasRefPoint,
in PointStruct RefPoint)
raises (SALOME::SALOME_Exception);
ListOfGroups ExtrusionAlongPathObject1DMakeGroups(in SMESH_IDSource theObject,
in SMESH_Mesh PathMesh,
in GEOM::GEOM_Object PathShape,
in long NodeStart,
in boolean HasAngles,
in double_array Angles,
in boolean HasRefPoint,
in PointStruct RefPoint,
out Extrusion_Error Error)
raises (SALOME::SALOME_Exception);
Extrusion_Error ExtrusionAlongPathObject2D(in SMESH_IDSource theObject,
in SMESH_Mesh PathMesh,
in GEOM::GEOM_Object PathShape,
in long NodeStart,
in boolean HasAngles,
in double_array Angles,
in boolean HasRefPoint,
in PointStruct RefPoint)
raises (SALOME::SALOME_Exception);
ListOfGroups ExtrusionAlongPathObject2DMakeGroups(in SMESH_IDSource theObject,
in SMESH_Mesh PathMesh,
in GEOM::GEOM_Object PathShape,
in long NodeStart,
in boolean HasAngles,
in double_array Angles,
in boolean HasRefPoint,
in PointStruct RefPoint,
out Extrusion_Error Error)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*! /*!

View File

@ -163,11 +163,26 @@ namespace MED
//--------------------------------------------------------------- //---------------------------------------------------------------
TVWrapper::TVWrapper(const std::string& theFileName): TVWrapper::TVWrapper(const std::string& theFileName):
myFile(new TFile(theFileName)) myFile(new TFile(theFileName))
{} {
TErr aRet;
myFile->Open( eLECTURE_ECRITURE, &aRet );
// if(aRet < 0)
// myFile->Close();
// myFile->Open( eLECTURE_AJOUT, &aRet );
// }
if(aRet < 0) {
myFile->Close();
myFile->Open( eLECTURE, &aRet );
}
if(aRet < 0) {
myFile->Close();
myFile->Open( eCREATION, &aRet );
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
TInt TInt
TVWrapper TVWrapper
@ -2871,5 +2886,5 @@ namespace MED
EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshGridStructRd(...)"); EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshGridStructRd(...)");
} }
} }
} }

View File

@ -4216,26 +4216,49 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems,
} }
//======================================================================= namespace
//function : isReverse
//purpose : Return true if normal of prevNodes is not co-directied with
// gp_Vec(prevNodes[iNotSame],nextNodes[iNotSame]).
// iNotSame is where prevNodes and nextNodes are different.
// If result is true then future volume orientation is OK
//=======================================================================
static bool isReverse(const SMDS_MeshElement* face,
const vector<const SMDS_MeshNode*>& prevNodes,
const vector<const SMDS_MeshNode*>& nextNodes,
const int iNotSame)
{ {
//=======================================================================
//function : isReverse
//purpose : Return true if normal of prevNodes is not co-directied with
// gp_Vec(prevNodes[iNotSame],nextNodes[iNotSame]).
// iNotSame is where prevNodes and nextNodes are different.
// If result is true then future volume orientation is OK
//=======================================================================
SMESH_TNodeXYZ pP = prevNodes[ iNotSame ]; bool isReverse(const SMDS_MeshElement* face,
SMESH_TNodeXYZ pN = nextNodes[ iNotSame ]; const vector<const SMDS_MeshNode*>& prevNodes,
gp_XYZ extrDir( pN - pP ), faceNorm; const vector<const SMDS_MeshNode*>& nextNodes,
SMESH_MeshAlgos::FaceNormal( face, faceNorm, /*normalized=*/false ); const int iNotSame)
{
return faceNorm * extrDir < 0.0; SMESH_TNodeXYZ pP = prevNodes[ iNotSame ];
SMESH_TNodeXYZ pN = nextNodes[ iNotSame ];
gp_XYZ extrDir( pN - pP ), faceNorm;
SMESH_MeshAlgos::FaceNormal( face, faceNorm, /*normalized=*/false );
return faceNorm * extrDir < 0.0;
}
//================================================================================
/*!
* \brief Assure that theElemSets[0] holds elements, not nodes
*/
//================================================================================
void setElemsFirst( TIDSortedElemSet theElemSets[2] )
{
if ( !theElemSets[0].empty() &&
(*theElemSets[0].begin())->GetType() == SMDSAbs_Node )
{
std::swap( theElemSets[0], theElemSets[1] );
}
else if ( !theElemSets[1].empty() &&
(*theElemSets[1].begin())->GetType() != SMDSAbs_Node )
{
std::swap( theElemSets[0], theElemSets[1] );
}
}
} }
//======================================================================= //=======================================================================
@ -5121,7 +5144,7 @@ void SMESH_MeshEditor::makeWalls (TNodeOfNodeListMap & mapNewNodes,
//======================================================================= //=======================================================================
SMESH_MeshEditor::PGroupIDs SMESH_MeshEditor::PGroupIDs
SMESH_MeshEditor::RotationSweep(TIDSortedElemSet & theElems, SMESH_MeshEditor::RotationSweep(TIDSortedElemSet theElemSets[2],
const gp_Ax1& theAxis, const gp_Ax1& theAxis,
const double theAngle, const double theAngle,
const int theNbSteps, const int theNbSteps,
@ -5153,84 +5176,89 @@ SMESH_MeshEditor::RotationSweep(TIDSortedElemSet & theElems,
const bool isQuadraticMesh = bool( myMesh->NbEdges(ORDER_QUADRATIC) + const bool isQuadraticMesh = bool( myMesh->NbEdges(ORDER_QUADRATIC) +
myMesh->NbFaces(ORDER_QUADRATIC) + myMesh->NbFaces(ORDER_QUADRATIC) +
myMesh->NbVolumes(ORDER_QUADRATIC) ); myMesh->NbVolumes(ORDER_QUADRATIC) );
// loop on theElems // loop on theElemSets
setElemsFirst( theElemSets );
TIDSortedElemSet::iterator itElem; TIDSortedElemSet::iterator itElem;
for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ ) { for ( int is2ndSet = 0; is2ndSet < 2; ++is2ndSet )
const SMDS_MeshElement* elem = *itElem; {
if ( !elem || elem->GetType() == SMDSAbs_Volume ) TIDSortedElemSet& theElems = theElemSets[ is2ndSet ];
continue; for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ ) {
vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ]; const SMDS_MeshElement* elem = *itElem;
newNodesItVec.reserve( elem->NbNodes() ); if ( !elem || elem->GetType() == SMDSAbs_Volume )
continue;
vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ];
newNodesItVec.reserve( elem->NbNodes() );
// loop on elem nodes // loop on elem nodes
SMDS_ElemIteratorPtr itN = elem->nodesIterator(); SMDS_ElemIteratorPtr itN = elem->nodesIterator();
while ( itN->more() ) while ( itN->more() )
{
// check if a node has been already sweeped
const SMDS_MeshNode* node = cast2Node( itN->next() );
gp_XYZ aXYZ( node->X(), node->Y(), node->Z() );
double coord[3];
aXYZ.Coord( coord[0], coord[1], coord[2] );
bool isOnAxis = ( aLine.SquareDistance( aXYZ ) <= aSqTol );
TNodeOfNodeListMapItr nIt =
mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first;
list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
if ( listNewNodes.empty() )
{ {
// check if we are to create medium nodes between corner ones // check if a node has been already sweeped
bool needMediumNodes = false; const SMDS_MeshNode* node = cast2Node( itN->next() );
if ( isQuadraticMesh )
{
SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
while (it->more() && !needMediumNodes )
{
const SMDS_MeshElement* invElem = it->next();
if ( invElem != elem && !theElems.count( invElem )) continue;
needMediumNodes = ( invElem->IsQuadratic() && !invElem->IsMediumNode(node) );
if ( !needMediumNodes && invElem->GetEntityType() == SMDSEntity_BiQuad_Quadrangle )
needMediumNodes = true;
}
}
// make new nodes gp_XYZ aXYZ( node->X(), node->Y(), node->Z() );
const SMDS_MeshNode * newNode = node; double coord[3];
for ( int i = 0; i < theNbSteps; i++ ) { aXYZ.Coord( coord[0], coord[1], coord[2] );
if ( !isOnAxis ) { bool isOnAxis = ( aLine.SquareDistance( aXYZ ) <= aSqTol );
if ( needMediumNodes ) // create a medium node
TNodeOfNodeListMapItr nIt =
mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first;
list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
if ( listNewNodes.empty() )
{
// check if we are to create medium nodes between corner ones
bool needMediumNodes = false;
if ( isQuadraticMesh )
{
SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
while (it->more() && !needMediumNodes )
{ {
aTrsf2.Transforms( coord[0], coord[1], coord[2] ); const SMDS_MeshElement* invElem = it->next();
if ( invElem != elem && !theElems.count( invElem )) continue;
needMediumNodes = ( invElem->IsQuadratic() && !invElem->IsMediumNode(node) );
if ( !needMediumNodes && invElem->GetEntityType() == SMDSEntity_BiQuad_Quadrangle )
needMediumNodes = true;
}
}
// make new nodes
const SMDS_MeshNode * newNode = node;
for ( int i = 0; i < theNbSteps; i++ ) {
if ( !isOnAxis ) {
if ( needMediumNodes ) // create a medium node
{
aTrsf2.Transforms( coord[0], coord[1], coord[2] );
newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
myLastCreatedNodes.Append(newNode);
srcNodes.Append( node );
listNewNodes.push_back( newNode );
aTrsf2.Transforms( coord[0], coord[1], coord[2] );
}
else {
aTrsf.Transforms( coord[0], coord[1], coord[2] );
}
// create a corner node
newNode = aMesh->AddNode( coord[0], coord[1], coord[2] ); newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
myLastCreatedNodes.Append(newNode); myLastCreatedNodes.Append(newNode);
srcNodes.Append( node ); srcNodes.Append( node );
listNewNodes.push_back( newNode ); listNewNodes.push_back( newNode );
aTrsf2.Transforms( coord[0], coord[1], coord[2] );
} }
else { else {
aTrsf.Transforms( coord[0], coord[1], coord[2] ); listNewNodes.push_back( newNode );
// if ( needMediumNodes )
// listNewNodes.push_back( newNode );
} }
// create a corner node
newNode = aMesh->AddNode( coord[0], coord[1], coord[2] );
myLastCreatedNodes.Append(newNode);
srcNodes.Append( node );
listNewNodes.push_back( newNode );
}
else {
listNewNodes.push_back( newNode );
// if ( needMediumNodes )
// listNewNodes.push_back( newNode );
} }
} }
newNodesItVec.push_back( nIt );
} }
newNodesItVec.push_back( nIt ); // make new elements
sweepElement( elem, newNodesItVec, newElemsMap[elem], theNbSteps, srcElems );
} }
// make new elements
sweepElement( elem, newNodesItVec, newElemsMap[elem], theNbSteps, srcElems );
} }
if ( theMakeWalls ) if ( theMakeWalls )
makeWalls( mapNewNodes, newElemsMap, mapElemNewNodes, theElems, theNbSteps, srcElems ); makeWalls( mapNewNodes, newElemsMap, mapElemNewNodes, theElemSets[0], theNbSteps, srcElems );
PGroupIDs newGroupIDs; PGroupIDs newGroupIDs;
if ( theMakeGroups ) if ( theMakeGroups )
@ -5568,7 +5596,7 @@ makeNodesByNormal1D( SMESHDS_Mesh* mesh,
//======================================================================= //=======================================================================
SMESH_MeshEditor::PGroupIDs SMESH_MeshEditor::PGroupIDs
SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet & theElems, SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet theElems[2],
const gp_Vec& theStep, const gp_Vec& theStep,
const int theNbSteps, const int theNbSteps,
TTElemOfElemListMap& newElemsMap, TTElemOfElemListMap& newElemsMap,
@ -5586,7 +5614,7 @@ SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet & theElems,
//======================================================================= //=======================================================================
SMESH_MeshEditor::PGroupIDs SMESH_MeshEditor::PGroupIDs
SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet & theElems, SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet theElemSets[2],
ExtrusParam& theParams, ExtrusParam& theParams,
TTElemOfElemListMap& newElemsMap) TTElemOfElemListMap& newElemsMap)
{ {
@ -5598,8 +5626,9 @@ SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet & theElems,
SMESHDS_Mesh* aMesh = GetMeshDS(); SMESHDS_Mesh* aMesh = GetMeshDS();
setElemsFirst( theElemSets );
const int nbSteps = theParams.NbSteps(); const int nbSteps = theParams.NbSteps();
theParams.SetElementsToUse( theElems ); theParams.SetElementsToUse( theElemSets[0] );
TNodeOfNodeListMap mapNewNodes; TNodeOfNodeListMap mapNewNodes;
//TNodeOfNodeVecMap mapNewNodes; //TNodeOfNodeVecMap mapNewNodes;
@ -5611,68 +5640,72 @@ SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet & theElems,
myMesh->NbVolumes(ORDER_QUADRATIC) ); myMesh->NbVolumes(ORDER_QUADRATIC) );
// loop on theElems // loop on theElems
TIDSortedElemSet::iterator itElem; TIDSortedElemSet::iterator itElem;
for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ ) for ( int is2ndSet = 0; is2ndSet < 2; ++is2ndSet )
{ {
// check element type TIDSortedElemSet& theElems = theElemSets[ is2ndSet ];
const SMDS_MeshElement* elem = *itElem; for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
if ( !elem || elem->GetType() == SMDSAbs_Volume )
continue;
const size_t nbNodes = elem->NbNodes();
vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ];
newNodesItVec.reserve( nbNodes );
// loop on elem nodes
SMDS_ElemIteratorPtr itN = elem->nodesIterator();
while ( itN->more() )
{ {
// check if a node has been already sweeped // check element type
const SMDS_MeshNode* node = cast2Node( itN->next() ); const SMDS_MeshElement* elem = *itElem;
TNodeOfNodeListMap::iterator nIt = if ( !elem || elem->GetType() == SMDSAbs_Volume )
mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first; continue;
list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
if ( listNewNodes.empty() )
{
// make new nodes
// check if we are to create medium nodes between corner ones const size_t nbNodes = elem->NbNodes();
bool needMediumNodes = false; vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ];
if ( isQuadraticMesh ) newNodesItVec.reserve( nbNodes );
// loop on elem nodes
SMDS_ElemIteratorPtr itN = elem->nodesIterator();
while ( itN->more() )
{
// check if a node has been already sweeped
const SMDS_MeshNode* node = cast2Node( itN->next() );
TNodeOfNodeListMap::iterator nIt =
mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first;
list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
if ( listNewNodes.empty() )
{ {
SMDS_ElemIteratorPtr it = node->GetInverseElementIterator(); // make new nodes
while (it->more() && !needMediumNodes )
// check if we are to create medium nodes between corner ones
bool needMediumNodes = false;
if ( isQuadraticMesh )
{ {
const SMDS_MeshElement* invElem = it->next(); SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
if ( invElem != elem && !theElems.count( invElem )) continue; while (it->more() && !needMediumNodes )
needMediumNodes = ( invElem->IsQuadratic() && !invElem->IsMediumNode(node) ); {
if ( !needMediumNodes && invElem->GetEntityType() == SMDSEntity_BiQuad_Quadrangle ) const SMDS_MeshElement* invElem = it->next();
needMediumNodes = true; if ( invElem != elem && !theElems.count( invElem )) continue;
needMediumNodes = ( invElem->IsQuadratic() && !invElem->IsMediumNode(node) );
if ( !needMediumNodes && invElem->GetEntityType() == SMDSEntity_BiQuad_Quadrangle )
needMediumNodes = true;
}
}
// create nodes for all steps
if ( theParams.MakeNodes( GetMeshDS(), node, listNewNodes, needMediumNodes ))
{
list<const SMDS_MeshNode*>::iterator newNodesIt = listNewNodes.begin();
for ( ; newNodesIt != listNewNodes.end(); ++newNodesIt )
{
myLastCreatedNodes.Append( *newNodesIt );
srcNodes.Append( node );
}
}
else
{
break; // newNodesItVec will be shorter than nbNodes
} }
} }
// create nodes for all steps newNodesItVec.push_back( nIt );
if ( theParams.MakeNodes( GetMeshDS(), node, listNewNodes, needMediumNodes ))
{
list<const SMDS_MeshNode*>::iterator newNodesIt = listNewNodes.begin();
for ( ; newNodesIt != listNewNodes.end(); ++newNodesIt )
{
myLastCreatedNodes.Append( *newNodesIt );
srcNodes.Append( node );
}
}
else
{
break; // newNodesItVec will be shorter than nbNodes
}
} }
newNodesItVec.push_back( nIt ); // make new elements
if ( newNodesItVec.size() == nbNodes )
sweepElement( elem, newNodesItVec, newElemsMap[elem], nbSteps, srcElems );
} }
// make new elements
if ( newNodesItVec.size() == nbNodes )
sweepElement( elem, newNodesItVec, newElemsMap[elem], nbSteps, srcElems );
} }
if ( theParams.ToMakeBoundary() ) { if ( theParams.ToMakeBoundary() ) {
makeWalls( mapNewNodes, newElemsMap, mapElemNewNodes, theElems, nbSteps, srcElems ); makeWalls( mapNewNodes, newElemsMap, mapElemNewNodes, theElemSets[0], nbSteps, srcElems );
} }
PGroupIDs newGroupIDs; PGroupIDs newGroupIDs;
if ( theParams.ToMakeGroups() ) if ( theParams.ToMakeGroups() )
@ -5686,7 +5719,7 @@ SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet & theElems,
//purpose : //purpose :
//======================================================================= //=======================================================================
SMESH_MeshEditor::Extrusion_Error SMESH_MeshEditor::Extrusion_Error
SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements, SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet theElements[2],
SMESH_subMesh* theTrack, SMESH_subMesh* theTrack,
const SMDS_MeshNode* theN1, const SMDS_MeshNode* theN1,
const bool theHasAngles, const bool theHasAngles,
@ -5715,7 +5748,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
TNodeOfNodeListMap mapNewNodes; TNodeOfNodeListMap mapNewNodes;
// 1. Check data // 1. Check data
aNbE = theElements.size(); aNbE = theElements[0].size() + theElements[1].size();
// nothing to do // nothing to do
if ( !aNbE ) if ( !aNbE )
return EXTR_NO_ELEMENTS; return EXTR_NO_ELEMENTS;
@ -5858,7 +5891,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
//purpose : //purpose :
//======================================================================= //=======================================================================
SMESH_MeshEditor::Extrusion_Error SMESH_MeshEditor::Extrusion_Error
SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements, SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet theElements[2],
SMESH_Mesh* theTrack, SMESH_Mesh* theTrack,
const SMDS_MeshNode* theN1, const SMDS_MeshNode* theN1,
const bool theHasAngles, const bool theHasAngles,
@ -5886,7 +5919,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
TNodeOfNodeListMap mapNewNodes; TNodeOfNodeListMap mapNewNodes;
// 1. Check data // 1. Check data
aNbE = theElements.size(); aNbE = theElements[0].size() + theElements[1].size();
// nothing to do // nothing to do
if ( !aNbE ) if ( !aNbE )
return EXTR_NO_ELEMENTS; return EXTR_NO_ELEMENTS;
@ -5927,7 +5960,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
} }
conn = nbEdgeConnectivity(theN1); conn = nbEdgeConnectivity(theN1);
if(conn > 2) if( conn != 1 )
return EXTR_PATH_NOT_EDGE; return EXTR_PATH_NOT_EDGE;
aItE = theN1->GetInverseElementIterator(); aItE = theN1->GetInverseElementIterator();
@ -6207,7 +6240,7 @@ SMESH_MeshEditor::MakeEdgePathPoints(std::list<double>& aPrms,
//purpose : auxilary for ExtrusionAlongTrack //purpose : auxilary for ExtrusionAlongTrack
//======================================================================= //=======================================================================
SMESH_MeshEditor::Extrusion_Error SMESH_MeshEditor::Extrusion_Error
SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements, SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet theElemSets[2],
list<SMESH_MeshEditor_PathPoint>& fullList, list<SMESH_MeshEditor_PathPoint>& fullList,
const bool theHasAngles, const bool theHasAngles,
list<double>& theAngles, list<double>& theAngles,
@ -6245,15 +6278,19 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements
gp_XYZ aGC( 0.,0.,0. ); gp_XYZ aGC( 0.,0.,0. );
TIDSortedElemSet newNodes; TIDSortedElemSet newNodes;
itElem = theElements.begin(); for ( int is2ndSet = 0; is2ndSet < 2; ++is2ndSet )
for ( ; itElem != theElements.end(); itElem++ ) { {
const SMDS_MeshElement* elem = *itElem; TIDSortedElemSet& theElements = theElemSets[ is2ndSet ];
itElem = theElements.begin();
for ( ; itElem != theElements.end(); itElem++ ) {
const SMDS_MeshElement* elem = *itElem;
SMDS_ElemIteratorPtr itN = elem->nodesIterator(); SMDS_ElemIteratorPtr itN = elem->nodesIterator();
while ( itN->more() ) { while ( itN->more() ) {
const SMDS_MeshElement* node = itN->next(); const SMDS_MeshElement* node = itN->next();
if ( newNodes.insert( node ).second ) if ( newNodes.insert( node ).second )
aGC += SMESH_TNodeXYZ( node ); aGC += SMESH_TNodeXYZ( node );
}
} }
} }
aGC /= newNodes.size(); aGC /= newNodes.size();
@ -6263,144 +6300,149 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements
// 4. Processing the elements // 4. Processing the elements
SMESHDS_Mesh* aMesh = GetMeshDS(); SMESHDS_Mesh* aMesh = GetMeshDS();
for ( itElem = theElements.begin(); itElem != theElements.end(); itElem++ ) { setElemsFirst( theElemSets );
// check element type for ( int is2ndSet = 0; is2ndSet < 2; ++is2ndSet )
const SMDS_MeshElement* elem = *itElem; {
SMDSAbs_ElementType aTypeE = elem->GetType(); TIDSortedElemSet& theElements = theElemSets[ is2ndSet ];
if ( !elem || ( aTypeE != SMDSAbs_Face && aTypeE != SMDSAbs_Edge ) ) for ( itElem = theElements.begin(); itElem != theElements.end(); itElem++ ) {
continue; // check element type
const SMDS_MeshElement* elem = *itElem;
SMDSAbs_ElementType aTypeE = elem->GetType();
if ( !elem /*|| ( aTypeE != SMDSAbs_Face && aTypeE != SMDSAbs_Edge )*/ )
continue;
vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ]; vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ];
newNodesItVec.reserve( elem->NbNodes() ); newNodesItVec.reserve( elem->NbNodes() );
// loop on elem nodes // loop on elem nodes
int nodeIndex = -1; int nodeIndex = -1;
SMDS_ElemIteratorPtr itN = elem->nodesIterator(); SMDS_ElemIteratorPtr itN = elem->nodesIterator();
while ( itN->more() ) while ( itN->more() )
{ {
++nodeIndex; ++nodeIndex;
// check if a node has been already processed // check if a node has been already processed
const SMDS_MeshNode* node = const SMDS_MeshNode* node =
static_cast<const SMDS_MeshNode*>( itN->next() ); static_cast<const SMDS_MeshNode*>( itN->next() );
TNodeOfNodeListMap::iterator nIt = mapNewNodes.find( node ); TNodeOfNodeListMap::iterator nIt = mapNewNodes.find( node );
if ( nIt == mapNewNodes.end() ) { if ( nIt == mapNewNodes.end() ) {
nIt = mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first; nIt = mapNewNodes.insert( make_pair( node, list<const SMDS_MeshNode*>() )).first;
list<const SMDS_MeshNode*>& listNewNodes = nIt->second; list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
// make new nodes // make new nodes
Standard_Real aAngle1x, aAngleT1T0, aTolAng; Standard_Real aAngle1x, aAngleT1T0, aTolAng;
gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x; gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x;
gp_Ax1 anAx1, anAxT1T0; gp_Ax1 anAx1, anAxT1T0;
gp_Dir aDT1x, aDT0x, aDT1T0; gp_Dir aDT1x, aDT0x, aDT1T0;
aTolAng=1.e-4; aTolAng=1.e-4;
aV0x = aV0; aV0x = aV0;
aPN0 = SMESH_TNodeXYZ( node ); aPN0 = SMESH_TNodeXYZ( node );
const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0]; const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0];
aP0x = aPP0.Pnt(); aP0x = aPP0.Pnt();
aDT0x= aPP0.Tangent(); aDT0x= aPP0.Tangent();
//cout<<"j = 0 PP: Pnt("<<aP0x.X()<<","<<aP0x.Y()<<","<<aP0x.Z()<<")"<<endl; //cout<<"j = 0 PP: Pnt("<<aP0x.X()<<","<<aP0x.Y()<<","<<aP0x.Z()<<")"<<endl;
for ( int j = 1; j < aNbTP; ++j ) { for ( int j = 1; j < aNbTP; ++j ) {
const SMESH_MeshEditor_PathPoint& aPP1 = aPPs[j]; const SMESH_MeshEditor_PathPoint& aPP1 = aPPs[j];
aP1x = aPP1.Pnt(); aP1x = aPP1.Pnt();
aDT1x = aPP1.Tangent(); aDT1x = aPP1.Tangent();
aAngle1x = aPP1.Angle(); aAngle1x = aPP1.Angle();
gp_Trsf aTrsf, aTrsfRot, aTrsfRotT1T0; gp_Trsf aTrsf, aTrsfRot, aTrsfRotT1T0;
// Translation // Translation
gp_Vec aV01x( aP0x, aP1x ); gp_Vec aV01x( aP0x, aP1x );
aTrsf.SetTranslation( aV01x ); aTrsf.SetTranslation( aV01x );
// traslated point // traslated point
aV1x = aV0x.Transformed( aTrsf ); aV1x = aV0x.Transformed( aTrsf );
aPN1 = aPN0.Transformed( aTrsf ); aPN1 = aPN0.Transformed( aTrsf );
// rotation 1 [ T1,T0 ] // rotation 1 [ T1,T0 ]
aAngleT1T0=-aDT1x.Angle( aDT0x ); aAngleT1T0=-aDT1x.Angle( aDT0x );
if (fabs(aAngleT1T0) > aTolAng) { if (fabs(aAngleT1T0) > aTolAng) {
aDT1T0=aDT1x^aDT0x; aDT1T0=aDT1x^aDT0x;
anAxT1T0.SetLocation( aV1x ); anAxT1T0.SetLocation( aV1x );
anAxT1T0.SetDirection( aDT1T0 ); anAxT1T0.SetDirection( aDT1T0 );
aTrsfRotT1T0.SetRotation( anAxT1T0, aAngleT1T0 ); aTrsfRotT1T0.SetRotation( anAxT1T0, aAngleT1T0 );
aPN1 = aPN1.Transformed( aTrsfRotT1T0 ); aPN1 = aPN1.Transformed( aTrsfRotT1T0 );
} }
// rotation 2 // rotation 2
if ( theHasAngles ) { if ( theHasAngles ) {
anAx1.SetLocation( aV1x ); anAx1.SetLocation( aV1x );
anAx1.SetDirection( aDT1x ); anAx1.SetDirection( aDT1x );
aTrsfRot.SetRotation( anAx1, aAngle1x ); aTrsfRot.SetRotation( anAx1, aAngle1x );
aPN1 = aPN1.Transformed( aTrsfRot ); aPN1 = aPN1.Transformed( aTrsfRot );
} }
// make new node // make new node
//MESSAGE("elem->IsQuadratic " << elem->IsQuadratic() << " " << elem->IsMediumNode(node)); //MESSAGE("elem->IsQuadratic " << elem->IsQuadratic() << " " << elem->IsMediumNode(node));
if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) { if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) {
// create additional node // create additional node
double x = ( aPN1.X() + aPN0.X() )/2.; double x = ( aPN1.X() + aPN0.X() )/2.;
double y = ( aPN1.Y() + aPN0.Y() )/2.; double y = ( aPN1.Y() + aPN0.Y() )/2.;
double z = ( aPN1.Z() + aPN0.Z() )/2.; double z = ( aPN1.Z() + aPN0.Z() )/2.;
const SMDS_MeshNode* newNode = aMesh->AddNode(x,y,z); const SMDS_MeshNode* newNode = aMesh->AddNode(x,y,z);
myLastCreatedNodes.Append(newNode);
srcNodes.Append( node );
listNewNodes.push_back( newNode );
}
const SMDS_MeshNode* newNode = aMesh->AddNode( aPN1.X(), aPN1.Y(), aPN1.Z() );
myLastCreatedNodes.Append(newNode); myLastCreatedNodes.Append(newNode);
srcNodes.Append( node ); srcNodes.Append( node );
listNewNodes.push_back( newNode ); listNewNodes.push_back( newNode );
aPN0 = aPN1;
aP0x = aP1x;
aV0x = aV1x;
aDT0x = aDT1x;
} }
const SMDS_MeshNode* newNode = aMesh->AddNode( aPN1.X(), aPN1.Y(), aPN1.Z() );
myLastCreatedNodes.Append(newNode);
srcNodes.Append( node );
listNewNodes.push_back( newNode );
aPN0 = aPN1;
aP0x = aP1x;
aV0x = aV1x;
aDT0x = aDT1x;
} }
}
else { else {
// if current elem is quadratic and current node is not medium // if current elem is quadratic and current node is not medium
// we have to check - may be it is needed to insert additional nodes // we have to check - may be it is needed to insert additional nodes
if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) { if( elem->IsQuadratic() && !elem->IsMediumNode(node) ) {
list< const SMDS_MeshNode* > & listNewNodes = nIt->second; list< const SMDS_MeshNode* > & listNewNodes = nIt->second;
if(listNewNodes.size()==aNbTP-1) { if(listNewNodes.size()==aNbTP-1) {
vector<const SMDS_MeshNode*> aNodes(2*(aNbTP-1)); vector<const SMDS_MeshNode*> aNodes(2*(aNbTP-1));
gp_XYZ P(node->X(), node->Y(), node->Z()); gp_XYZ P(node->X(), node->Y(), node->Z());
list< const SMDS_MeshNode* >::iterator it = listNewNodes.begin(); list< const SMDS_MeshNode* >::iterator it = listNewNodes.begin();
int i; int i;
for(i=0; i<aNbTP-1; i++) { for(i=0; i<aNbTP-1; i++) {
const SMDS_MeshNode* N = *it; const SMDS_MeshNode* N = *it;
double x = ( N->X() + P.X() )/2.; double x = ( N->X() + P.X() )/2.;
double y = ( N->Y() + P.Y() )/2.; double y = ( N->Y() + P.Y() )/2.;
double z = ( N->Z() + P.Z() )/2.; double z = ( N->Z() + P.Z() )/2.;
const SMDS_MeshNode* newN = aMesh->AddNode(x,y,z); const SMDS_MeshNode* newN = aMesh->AddNode(x,y,z);
srcNodes.Append( node ); srcNodes.Append( node );
myLastCreatedNodes.Append(newN); myLastCreatedNodes.Append(newN);
aNodes[2*i] = newN; aNodes[2*i] = newN;
aNodes[2*i+1] = N; aNodes[2*i+1] = N;
P = gp_XYZ(N->X(),N->Y(),N->Z()); P = gp_XYZ(N->X(),N->Y(),N->Z());
} }
listNewNodes.clear(); listNewNodes.clear();
for(i=0; i<2*(aNbTP-1); i++) { for(i=0; i<2*(aNbTP-1); i++) {
listNewNodes.push_back(aNodes[i]); listNewNodes.push_back(aNodes[i]);
}
} }
} }
} }
}
newNodesItVec.push_back( nIt ); newNodesItVec.push_back( nIt );
}
// make new elements
//sweepElement( aMesh, elem, newNodesItVec, newElemsMap[elem],
// newNodesItVec[0]->second.size(), myLastCreatedElems );
sweepElement( elem, newNodesItVec, newElemsMap[elem], aNbTP-1, srcElems );
} }
// make new elements
//sweepElement( aMesh, elem, newNodesItVec, newElemsMap[elem],
// newNodesItVec[0]->second.size(), myLastCreatedElems );
sweepElement( elem, newNodesItVec, newElemsMap[elem], aNbTP-1, srcElems );
} }
makeWalls( mapNewNodes, newElemsMap, mapElemNewNodes, theElements, aNbTP-1, srcElems ); makeWalls( mapNewNodes, newElemsMap, mapElemNewNodes, theElemSets[0], aNbTP-1, srcElems );
if ( theMakeGroups ) if ( theMakeGroups )
generateGroups( srcNodes, srcElems, "extruded"); generateGroups( srcNodes, srcElems, "extruded");

View File

@ -229,7 +229,7 @@ public:
typedef std::map<const SMDS_MeshElement*, TVecOfNnlmiMap, TElemSort > TElemOfVecOfNnlmiMap; typedef std::map<const SMDS_MeshElement*, TVecOfNnlmiMap, TElemSort > TElemOfVecOfNnlmiMap;
typedef std::auto_ptr< std::list<int> > PGroupIDs; typedef std::auto_ptr< std::list<int> > PGroupIDs;
PGroupIDs RotationSweep (TIDSortedElemSet & theElements, PGroupIDs RotationSweep (TIDSortedElemSet theElements[2],
const gp_Ax1& theAxis, const gp_Ax1& theAxis,
const double theAngle, const double theAngle,
const int theNbSteps, const int theNbSteps,
@ -345,7 +345,7 @@ public:
* @param theTolerance - uses for comparing locations of nodes if flag * @param theTolerance - uses for comparing locations of nodes if flag
* EXTRUSION_FLAG_SEW is set * EXTRUSION_FLAG_SEW is set
*/ */
PGroupIDs ExtrusionSweep (TIDSortedElemSet & theElems, PGroupIDs ExtrusionSweep (TIDSortedElemSet theElems[2],
const gp_Vec& theStep, const gp_Vec& theStep,
const int theNbSteps, const int theNbSteps,
TTElemOfElemListMap& newElemsMap, TTElemOfElemListMap& newElemsMap,
@ -362,7 +362,7 @@ public:
* EXTRUSION_FLAG_SEW is set * EXTRUSION_FLAG_SEW is set
* @param theParams - special structure for manage of extrusion * @param theParams - special structure for manage of extrusion
*/ */
PGroupIDs ExtrusionSweep (TIDSortedElemSet & theElems, PGroupIDs ExtrusionSweep (TIDSortedElemSet theElems[2],
ExtrusParam& theParams, ExtrusParam& theParams,
TTElemOfElemListMap& newElemsMap); TTElemOfElemListMap& newElemsMap);
@ -380,7 +380,7 @@ public:
EXTR_CANT_GET_TANGENT EXTR_CANT_GET_TANGENT
}; };
Extrusion_Error ExtrusionAlongTrack (TIDSortedElemSet & theElements, Extrusion_Error ExtrusionAlongTrack (TIDSortedElemSet theElements[2],
SMESH_subMesh* theTrackPattern, SMESH_subMesh* theTrackPattern,
const SMDS_MeshNode* theNodeStart, const SMDS_MeshNode* theNodeStart,
const bool theHasAngles, const bool theHasAngles,
@ -389,7 +389,7 @@ public:
const bool theHasRefPoint, const bool theHasRefPoint,
const gp_Pnt& theRefPoint, const gp_Pnt& theRefPoint,
const bool theMakeGroups); const bool theMakeGroups);
Extrusion_Error ExtrusionAlongTrack (TIDSortedElemSet & theElements, Extrusion_Error ExtrusionAlongTrack (TIDSortedElemSet theElements[2],
SMESH_Mesh* theTrackPattern, SMESH_Mesh* theTrackPattern,
const SMDS_MeshNode* theNodeStart, const SMDS_MeshNode* theNodeStart,
const bool theHasAngles, const bool theHasAngles,
@ -730,7 +730,7 @@ public:
const TopoDS_Edge& aTrackEdge, const TopoDS_Edge& aTrackEdge,
bool aFirstIsStart, bool aFirstIsStart,
std::list<SMESH_MeshEditor_PathPoint>& aLPP); std::list<SMESH_MeshEditor_PathPoint>& aLPP);
Extrusion_Error MakeExtrElements(TIDSortedElemSet& theElements, Extrusion_Error MakeExtrElements(TIDSortedElemSet theElements[2],
std::list<SMESH_MeshEditor_PathPoint>& theFullList, std::list<SMESH_MeshEditor_PathPoint>& theFullList,
const bool theHasAngles, const bool theHasAngles,
std::list<double>& theAngles, std::list<double>& theAngles,

View File

@ -353,7 +353,7 @@ bool SMESHGUI_Add0DElemsOnAllNodesOp::onApply()
return false; return false;
// get a mesh // get a mesh
SMESH::SMESH_IDSource_wrap meshObject; SMESH::IDSource_wrap meshObject;
SMESH::SMESH_Mesh_var mesh; SMESH::SMESH_Mesh_var mesh;
if ( !myIO.IsNull() ) if ( !myIO.IsNull() )
{ {

View File

@ -309,7 +309,8 @@ bool SMESHGUI_CopyMeshDlg::ClickOnApply()
try try
{ {
SUIT_OverrideCursor aWaitCursor; SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_IDSource_wrap aPartToCopy;
SMESH::IDSource_wrap aPartToCopy;
if ( myIdSourceCheck->isChecked()) if ( myIdSourceCheck->isChecked())
{ {
aPartToCopy = mySelectedObject; aPartToCopy = mySelectedObject;

View File

@ -22,22 +22,23 @@
#include "SMESHGUI_DisplayEntitiesDlg.h" #include "SMESHGUI_DisplayEntitiesDlg.h"
#include "SMESHGUI.h" #include "SMESHGUI.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_Utils.h" #include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include <QLabel>
#include <QGroupBox>
#include <QGridLayout>
#include <QVBoxLayout>
#include <QCheckBox>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <LightApp_Application.h> #include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
#include <SALOME_ListIO.hxx> #include <SALOME_ListIO.hxx>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <QCheckBox>
#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
#include <QVBoxLayout>
const int MARGIN = 9; const int MARGIN = 9;
const int SPACING = 6; const int SPACING = 6;
@ -176,7 +177,7 @@ SMESHGUI_DisplayEntitiesDlg::~SMESHGUI_DisplayEntitiesDlg()
} }
void SMESHGUI_DisplayEntitiesDlg::InverseEntityMode(unsigned int& theOutputMode, void SMESHGUI_DisplayEntitiesDlg::InverseEntityMode(unsigned int& theOutputMode,
unsigned int theMode) unsigned int theMode)
{ {
bool anIsNotPresent = ~theOutputMode & theMode; bool anIsNotPresent = ~theOutputMode & theMode;
if(anIsNotPresent) if(anIsNotPresent)
@ -193,7 +194,7 @@ void SMESHGUI_DisplayEntitiesDlg::onChangeEntityMode( bool isChecked )
QCheckBox* aSender = (QCheckBox*)sender(); QCheckBox* aSender = (QCheckBox*)sender();
if ( myNbCheckedButtons == 1 && !isChecked ) { if ( myNbCheckedButtons == 1 && !isChecked ) {
SUIT_MessageBox::warning(this, tr("SMESH_WRN_WARNING"), SUIT_MessageBox::warning(this, tr("SMESH_WRN_WARNING"),
tr("WRN_AT_LEAST_ONE")); tr("WRN_AT_LEAST_ONE"));
disconnect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) ); disconnect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
aSender->setChecked( true ); aSender->setChecked( true );
connect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) ); connect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
@ -228,11 +229,13 @@ void SMESHGUI_DisplayEntitiesDlg::onHelp()
*/ */
void SMESHGUI_DisplayEntitiesDlg::onOk() void SMESHGUI_DisplayEntitiesDlg::onOk()
{ {
SUIT_OverrideCursor wc;
const char* entry = myIObject->getEntry(); const char* entry = myIObject->getEntry();
if ( !myActor ) { if ( !myActor ) {
myActor = SMESH::CreateActor(SMESH::GetActiveStudyDocument(), myActor = SMESH::CreateActor(SMESH::GetActiveStudyDocument(),
entry, true); entry, true);
} }
if( myEntityMode != myActor->GetEntityMode() ) { if( myEntityMode != myActor->GetEntityMode() ) {

File diff suppressed because it is too large Load Diff

View File

@ -45,14 +45,15 @@ class QCheckBox;
class QListWidget; class QListWidget;
class QPushButton; class QPushButton;
class LightApp_SelectionMgr;
class SMESHGUI; class SMESHGUI;
class SMESH_Actor; class SMESHGUI_3TypesSelector;
class SMESHGUI_FilterDlg;
class SMESHGUI_IdValidator; class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox; class SMESHGUI_SpinBox;
class SMESHGUI_FilterDlg; class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
class SUIT_SelectionFilter; class SUIT_SelectionFilter;
class SVTK_Selector;
//================================================================================= //=================================================================================
// class : SMESHGUI_ExtrusionAlongPathDlg // class : SMESHGUI_ExtrusionAlongPathDlg
@ -75,13 +76,11 @@ private:
void Init( bool = true ); void Init( bool = true );
void enterEvent( QEvent* ); /* mouse enter the QWidget */ void enterEvent( QEvent* ); /* mouse enter the QWidget */
void keyPressEvent( QKeyEvent* ); void keyPressEvent( QKeyEvent* );
int GetConstructorId(); void SetEditCurrentArgument( QPushButton* );
void SetEditCurrentArgument( QToolButton* );
bool isValid(); bool isValid();
bool isValuesValid(); bool isValuesValid();
SMESH::long_array_var getSelectedElements();
SMESH::double_array_var getAngles(); SMESH::double_array_var getAngles();
void updateLinearAngles(); void updateLinearAngles();
@ -89,38 +88,20 @@ private:
SMESHGUI_IdValidator* myIdValidator; SMESHGUI_IdValidator* myIdValidator;
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
SVTK_Selector* mySelector; SVTK_Selector* mySelector;
QWidget* myEditCurrentArgument; /* Current argument */ QWidget* myEditCurrentArgument; /* Current argument */
bool myBusy; bool myBusy;
SMESH::SMESH_Mesh_var myMesh;
SMESH_Actor* myMeshActor;
SMESH::SMESH_IDSource_var myIDSource;
//SMESH::SMESH_Mesh_var myPathMesh;
SMESH::SMESH_IDSource_var myPath; SMESH::SMESH_IDSource_var myPath;
//GEOM::GEOM_Object_var myPathShape;
SUIT_SelectionFilter* myElementsFilter;
SUIT_SelectionFilter* myPathMeshFilter; SUIT_SelectionFilter* myPathMeshFilter;
int myType;
QList<double> myAnglesList; QList<double> myAnglesList;
// widgets // widgets
QGroupBox* ConstructorsBox; SMESHGUI_3TypesSelector* SelectorWdg;
QButtonGroup* GroupConstructors;
QRadioButton* Elements1dRB;
QRadioButton* Elements2dRB;
QGroupBox* GroupArguments; QGroupBox* GroupArguments;
QLabel* ElementsLab;
QToolButton* SelectElementsButton;
QLineEdit* ElementsLineEdit;
QCheckBox* MeshCheck;
QGroupBox* PathGrp; QGroupBox* PathGrp;
QToolButton* SelectPathMeshButton; QPushButton* SelectPathMeshButton;
QLineEdit* PathMeshLineEdit; QLineEdit* PathMeshLineEdit;
//QToolButton* SelectPathShapeButton; QPushButton* SelectStartPointButton;
//QLineEdit* PathShapeLineEdit;
QToolButton* SelectStartPointButton;
QLineEdit* StartPointLineEdit; QLineEdit* StartPointLineEdit;
QCheckBox* LinearAnglesCheck; QCheckBox* LinearAnglesCheck;
QGroupBox* AnglesGrp; QGroupBox* AnglesGrp;
@ -129,7 +110,7 @@ private:
QToolButton* RemoveAngleButton; QToolButton* RemoveAngleButton;
SMESHGUI_SpinBox* AngleSpin; SMESHGUI_SpinBox* AngleSpin;
QGroupBox* BasePointGrp; QGroupBox* BasePointGrp;
QToolButton* SelectBasePointButton; QPushButton* SelectBasePointButton;
SMESHGUI_SpinBox* XSpin; SMESHGUI_SpinBox* XSpin;
SMESHGUI_SpinBox* YSpin; SMESHGUI_SpinBox* YSpin;
SMESHGUI_SpinBox* ZSpin; SMESHGUI_SpinBox* ZSpin;
@ -143,27 +124,22 @@ private:
QString myHelpFileName; QString myHelpFileName;
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
protected slots: protected slots:
void reject(); void reject();
virtual void onDisplaySimulation( bool ); virtual void onDisplaySimulation( bool );
private slots: private slots:
void ConstructorsClicked( int );
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ClickOnHelp(); void ClickOnHelp();
void CheckIsEnable();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void SelectionIntoArgument(); void SelectionIntoArgument();
void DeactivateActiveDialog(); void DeactivateActiveDialog();
void ActivateThisDialog(); void ActivateThisDialog();
void onTextChange( const QString& ); void onTextChange( const QString& );
void onSelectMesh();
void OnAngleAdded(); void OnAngleAdded();
void OnAngleRemoved(); void OnAngleRemoved();
void setFilters();
}; };
#endif // SMESHGUI_EXTRUSIONALONGPATHDLG_H #endif // SMESHGUI_EXTRUSIONALONGPATHDLG_H

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,7 @@
// SMESH includes // SMESH includes
#include "SMESH_SMESHGUI.hxx" #include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_PreviewDlg.h" #include "SMESHGUI_PreviewDlg.h"
#include "SMESHGUI_Utils.h"
// SALOME GUI includes // SALOME GUI includes
#include <SALOME_InteractiveObject.hxx> #include <SALOME_InteractiveObject.hxx>
@ -57,15 +58,80 @@ class LightApp_SelectionMgr;
class SUIT_SelectionFilter; class SUIT_SelectionFilter;
class SalomeApp_IntSpinBox; class SalomeApp_IntSpinBox;
//=================================================================================
// class : SMESHGUI_ExtrusionDlg
// purpose : A widget used to select both nodes, edges and faces for
// Extrusion and Revolution operations
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_3TypesSelector : public QWidget
{
Q_OBJECT
public:
SMESHGUI_3TypesSelector( QWidget * parent = 0 );
~SMESHGUI_3TypesSelector();
void Clear();
void SetEnabled( bool enable, SMESH::ElementType type );
bool IsAnythingSelected( SMESH::ElementType type = SMESH::ALL );
SMESH::ElementType GetSelected( SMESH::ListOfIDSources & nodes,
SMESH::ListOfIDSources & edges,
SMESH::ListOfIDSources & faces );
SMESH::SMESH_Mesh_var GetMesh() { return myMesh; }
SMESH_Actor* GetActor() { return myActor; }
Handle(SALOME_InteractiveObject) GetIO() { return myIO; }
QButtonGroup* GetButtonGroup() { return mySelectBtnGrp; }
signals:
void selectionChanged();
private slots:
void selectionIntoArgument();
void onTextChange( const QString& );
void onSelectMesh( bool on );
void setFilters();
void onSelectType( int iType );
private:
void addTmpIdSource( SMESH::long_array_var& ids,
int iType, int index);
QGroupBox* myGroups [3];
QLabel* myLabel [3];
QLineEdit* myLineEdit [3];
QCheckBox* myMeshChk [3];
QPushButton* myFilterBtn[3];
QButtonGroup* mySelectBtnGrp;
SMESHGUI_FilterDlg* myFilterDlg;
SUIT_SelectionFilter* myFilter [3];
SMESHGUI_IdValidator* myIdValidator;
bool myBusy;
SMESH::SMESH_Mesh_var myMesh;
SMESH_Actor* myActor;
Handle(SALOME_InteractiveObject) myIO;
SMESH::ListOfIDSources_var myIDSource[3];
QList<SMESH::IDSource_wrap> myTmpIDSourceList;
LightApp_SelectionMgr* mySelectionMgr;
SVTK_Selector* mySelector;
};
//================================================================================= //=================================================================================
// class : SMESHGUI_ExtrusionDlg // class : SMESHGUI_ExtrusionDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public SMESHGUI_PreviewDlg class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public SMESHGUI_PreviewDlg
{ {
Q_OBJECT Q_OBJECT
public: public:
SMESHGUI_ExtrusionDlg( SMESHGUI* ); SMESHGUI_ExtrusionDlg( SMESHGUI* );
~SMESHGUI_ExtrusionDlg(); ~SMESHGUI_ExtrusionDlg();
@ -81,39 +147,16 @@ private:
bool isValid(); bool isValid();
bool isValuesValid(); bool isValuesValid();
SMESHGUI_IdValidator* myIdValidator;
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
QWidget* myEditCurrentArgument; /* Current argument editor */
int myNbOkElements; /* to check when elements are defined */
SVTK_Selector* mySelector; SVTK_Selector* mySelector;
SMESH::SMESH_IDSource_var mySelectedObject;
bool myBusy;
SMESH::SMESH_Mesh_var myMesh;
SMESH::long_array_var myElementsId;
SMESH_Actor* myActor;
Handle(SALOME_InteractiveObject) myIO;
SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter0D;
SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter1D;
SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter2D;
// widgets // widgets
QGroupBox* ConstructorsBox; SMESHGUI_3TypesSelector* SelectorWdg;
QButtonGroup* GroupConstructors;
QRadioButton* Contructor_RBut0;
QRadioButton* Contructor_RBut1;
QRadioButton* Contructor_RBut2;
QRadioButton* ExtrMethod_RBut0; QRadioButton* ExtrMethod_RBut0;
QRadioButton* ExtrMethod_RBut1; QRadioButton* ExtrMethod_RBut1;
QRadioButton* ExtrMethod_RBut2; QRadioButton* ExtrMethod_RBut2;
QGroupBox* GroupArguments; QGroupBox* GroupArguments;
QGroupBox* GroupDimensions;
QLabel* TextLabelElements;
QPushButton* SelectElementsButton;
QLineEdit* LineEditElements;
QCheckBox* CheckBoxMesh;
QLabel* TextLabelVector; QLabel* TextLabelVector;
QLabel* TextLabelDistance; QLabel* TextLabelDistance;
QPushButton* SelectVectorButton; QPushButton* SelectVectorButton;
@ -146,15 +189,11 @@ private:
QString myHelpFileName; QString myHelpFileName;
QString myIDs; QString myIDs;
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
protected slots: protected slots:
virtual void onDisplaySimulation( bool ); virtual void onDisplaySimulation( bool );
virtual void reject(); virtual void reject();
private slots: private slots:
void ConstructorsClicked( int );
void CheckIsEnable(); void CheckIsEnable();
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
@ -164,9 +203,6 @@ private slots:
void SelectionIntoArgument(); void SelectionIntoArgument();
void DeactivateActiveDialog(); void DeactivateActiveDialog();
void ActivateThisDialog(); void ActivateThisDialog();
void onTextChange( const QString& );
void onSelectMesh( bool );
void setFilters();
}; };
#endif // SMESHGUI_EXTRUSIONDLG_H #endif // SMESHGUI_EXTRUSIONDLG_H

View File

@ -3299,13 +3299,18 @@ bool SMESHGUI_FilterDlg::onApply()
insertFilterInViewer(); insertFilterInViewer();
if (!myFilter[ aCurrType ]->GetPredicate()->_is_nil()) { if (!myFilter[ aCurrType ]->GetPredicate()->_is_nil()) {
QList<int> aResultIds; //
filterSource(aCurrType, aResultIds); bool toFilter = (( SMESH::FindActorByObject( myMesh )) ||
// select in viewer ( myInitSourceWgOnApply && mySourceWg ) ||
selectInViewer(aCurrType, aResultIds); ( mySourceGrp->checkedId() == Dialog && mySourceWg ));
if ( toFilter ) {
QList<int> aResultIds;
filterSource(aCurrType, aResultIds);
// select in viewer
selectInViewer(aCurrType, aResultIds);
}
} }
myInsertState[ aCurrType ] = mySetInViewer->isChecked(); myInsertState[ aCurrType ] = mySetInViewer->isChecked();
myApplyToState[ aCurrType ] = mySourceGrp->checkedId(); myApplyToState[ aCurrType ] = mySourceGrp->checkedId();
} }

View File

@ -1135,6 +1135,8 @@ bool SMESHGUI_GroupDlg::onApply()
if( aMeshGroupSO ) if( aMeshGroupSO )
anEntryList.append( aMeshGroupSO->GetID().c_str() ); anEntryList.append( aMeshGroupSO->GetID().c_str() );
resultGroup->SetName(SMESH::toUtf8(myName->text().trimmed()));
if ( isCreation ) if ( isCreation )
{ {
SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" ); SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" );
@ -1151,8 +1153,6 @@ bool SMESHGUI_GroupDlg::onApply()
} }
else else
{ {
resultGroup->SetName(SMESH::toUtf8(myName->text()));
if ( aMeshGroupSO ) if ( aMeshGroupSO )
{ {
if ( SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) if ( SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str()))

View File

@ -35,10 +35,11 @@
#include <utilities.h> #include <utilities.h>
// SALOME GUI includes // SALOME GUI includes
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <LightApp_Application.h> #include <LightApp_Application.h>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SalomeApp_IntSpinBox.h> #include <SalomeApp_IntSpinBox.h>
// Qt includes // Qt includes
@ -264,6 +265,7 @@ void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
bool res = result==QDialog::Accepted; bool res = result==QDialog::Accepted;
if( res ) if( res )
{ {
SUIT_OverrideCursor wc;
/*QString paramValues = */storeParams(); /*QString paramValues = */storeParams();
// No longer needed since NoteBook appears and "Value" OB field shows names of variable // No longer needed since NoteBook appears and "Value" OB field shows names of variable
// if ( !paramValues.isEmpty() ) { // if ( !paramValues.isEmpty() ) {

View File

@ -519,8 +519,8 @@ void SMESHGUI_MinDistance::secondEdited()
void SMESHGUI_MinDistance::compute() void SMESHGUI_MinDistance::compute()
{ {
SUIT_OverrideCursor wc; SUIT_OverrideCursor wc;
SMESH::SMESH_IDSource_wrap s1; SMESH::IDSource_wrap s1;
SMESH::SMESH_IDSource_wrap s2; SMESH::IDSource_wrap s2;
bool isOrigin = mySecond->checkedId() == OriginTgt; bool isOrigin = mySecond->checkedId() == OriginTgt;
// process first target // process first target
@ -760,7 +760,8 @@ void SMESHGUI_BoundingBox::updateSelection()
sourceEdited(); sourceEdited();
//selectionChanged(); if ( mySource->text().isEmpty() )
selectionChanged();
} }
/*! /*!
@ -1206,6 +1207,9 @@ void SMESHGUI_BasicProperties::updateSelection()
selMgr->installFilter( myFilter ); selMgr->installFilter( myFilter );
connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) ); connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) );
if ( mySource->text().isEmpty() )
selectionChanged();
} }
/*! /*!

View File

@ -1283,7 +1283,7 @@ bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
{ {
if ( hasObj ) if ( hasObj )
return theEditor->QuadTo4Tri( obj ), true; return theEditor->QuadTo4Tri( obj ), true;
SMESH::SMESH_IDSource_wrap elems = theEditor->MakeIDSource( theIds, SMESH::FACE ); SMESH::IDSource_wrap elems = theEditor->MakeIDSource( theIds, SMESH::FACE );
theEditor->QuadTo4Tri( elems ); theEditor->QuadTo4Tri( elems );
return true; return true;
} }
@ -1619,7 +1619,7 @@ bool SMESHGUI_SplitVolumesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
const SMESH::long_array& theIds, const SMESH::long_array& theIds,
SMESH::SMESH_IDSource_ptr theObj) SMESH::SMESH_IDSource_ptr theObj)
{ {
SMESH::SMESH_IDSource_wrap obj = theObj; SMESH::IDSource_wrap obj = theObj;
if ( CORBA::is_nil( obj )) if ( CORBA::is_nil( obj ))
obj = theEditor->MakeIDSource( theIds, SMESH::VOLUME ); obj = theEditor->MakeIDSource( theIds, SMESH::VOLUME );
else else

View File

@ -332,6 +332,11 @@ void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText)
aViewWindow->highlight(anIO,true,true); aViewWindow->highlight(anIO,true,true);
} }
} }
else
{
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
myNbOkElements = aListId.count();
}
myBusy = false; myBusy = false;
updateButtons(); updateButtons();

View File

@ -35,6 +35,7 @@
#include "SMESHGUI_IdValidator.h" #include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_MeshEditPreview.h" #include "SMESHGUI_MeshEditPreview.h"
#include "SMESHGUI_FilterDlg.h" #include "SMESHGUI_FilterDlg.h"
#include "SMESHGUI_ExtrusionDlg.h"
#include <SMESH_Actor.h> #include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx> #include <SMESH_TypeFilter.hxx>
@ -91,66 +92,28 @@
SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
: SMESHGUI_PreviewDlg( theModule ), : SMESHGUI_PreviewDlg( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myVectorDefinition(NONE_SELECT), myVectorDefinition(NONE_SELECT)
myFilterDlg( 0 ),
mySelectedObject(SMESH::SMESH_IDSource::_nil()),
myActor(0)
{ {
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
QPixmap image0 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE"))); QPixmap image ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
QPixmap image1 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
QPixmap image2 ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
setModal(false); setModal(false);
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
setWindowTitle(tr("REVOLUTION_AROUND_AXIS")); setWindowTitle(tr("REVOLUTION_AROUND_AXIS"));
setSizeGripEnabled(true); setSizeGripEnabled(true);
QVBoxLayout* SMESHGUI_RevolutionDlgLayout = new QVBoxLayout(this); QVBoxLayout* SMESHGUI_RevolutionDlgLayout = new QVBoxLayout(this);
SMESHGUI_RevolutionDlgLayout->setSpacing(SPACING); SMESHGUI_RevolutionDlgLayout->setSpacing(SPACING);
SMESHGUI_RevolutionDlgLayout->setMargin(MARGIN); SMESHGUI_RevolutionDlgLayout->setMargin(MARGIN);
/***************************************************************/ /***************************************************************/
ConstructorsBox = new QGroupBox(tr("SMESH_REVOLUTION"), this); GroupArguments = new QGroupBox(tr("REVOLUTION"), this);
GroupConstructors = new QButtonGroup(this);
QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
ConstructorsBoxLayout->setSpacing(SPACING);
ConstructorsBoxLayout->setMargin(MARGIN);
RadioButton1 = new QRadioButton(ConstructorsBox);
RadioButton1->setIcon(image0);
RadioButton2 = new QRadioButton(ConstructorsBox);
RadioButton2->setIcon(image1);
ConstructorsBoxLayout->addWidget(RadioButton1);
ConstructorsBoxLayout->addWidget(RadioButton2);
GroupConstructors->addButton(RadioButton1, 0);
GroupConstructors->addButton(RadioButton2, 1);
/***************************************************************/
GroupArguments = new QGroupBox(tr("REVOLUTION_1D"), this);
QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments); QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
GroupArgumentsLayout->setSpacing(SPACING); GroupArgumentsLayout->setSpacing(SPACING);
GroupArgumentsLayout->setMargin(MARGIN); GroupArgumentsLayout->setMargin(MARGIN);
myIdValidator = new SMESHGUI_IdValidator(this);
// Controls for elements selection // Controls for elements selection
TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments); SelectorWdg = new SMESHGUI_3TypesSelector( GroupArguments );
SelectElementsButton = new QPushButton(GroupArguments);
SelectElementsButton->setIcon(image2);
LineEditElements = new QLineEdit(GroupArguments);
LineEditElements->setValidator(myIdValidator);
LineEditElements->setMaxLength(-1);
myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
// Control for the whole mesh selection
CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
// Controls for axis defining // Controls for axis defining
GroupAxis = new QGroupBox(tr("SMESH_AXIS"), GroupArguments); GroupAxis = new QGroupBox(tr("SMESH_AXIS"), GroupArguments);
@ -160,7 +123,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
TextLabelPoint = new QLabel(tr("SMESH_POINT"), GroupAxis); TextLabelPoint = new QLabel(tr("SMESH_POINT"), GroupAxis);
SelectPointButton = new QPushButton(GroupAxis); SelectPointButton = new QPushButton(GroupAxis);
SelectPointButton->setIcon(image2); SelectPointButton->setIcon(image);
SelectPointButton->setCheckable(true);
TextLabelX = new QLabel(tr("SMESH_X"), GroupAxis); TextLabelX = new QLabel(tr("SMESH_X"), GroupAxis);
SpinBox_X = new SMESHGUI_SpinBox(GroupAxis); SpinBox_X = new SMESHGUI_SpinBox(GroupAxis);
@ -173,7 +137,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupAxis); TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupAxis);
SelectVectorButton = new QPushButton(GroupAxis); SelectVectorButton = new QPushButton(GroupAxis);
SelectVectorButton->setIcon(image2); SelectVectorButton->setIcon(image);
SelectVectorButton->setCheckable(true);
TextLabelDX = new QLabel(tr("SMESH_DX"), GroupAxis); TextLabelDX = new QLabel(tr("SMESH_DX"), GroupAxis);
SpinBox_DX = new SMESHGUI_SpinBox(GroupAxis); SpinBox_DX = new SMESHGUI_SpinBox(GroupAxis);
@ -237,17 +202,16 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments); MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
MakeGroupsCheck->setChecked(true); MakeGroupsCheck->setChecked(true);
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0, 1, 4);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); GroupArgumentsLayout->addWidget(GroupAxis, 1, 0, 1, 4);
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2); GroupArgumentsLayout->addWidget(GroupAngleBox, 2, 0, 1, 4);
GroupArgumentsLayout->addWidget(myFilterBtn, 0, 3); GroupArgumentsLayout->addWidget(TextLabelTolerance, 3, 0, 1, 2);
GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4); GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 3, 2, 1, 2);
GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 4); GroupArgumentsLayout->addWidget(myPreviewCheckBox, 4, 0, 1, 4);
GroupArgumentsLayout->addWidget(GroupAngleBox, 3, 0, 1, 4); GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0, 1, 4);
GroupArgumentsLayout->addWidget(TextLabelTolerance, 4, 0, 1, 2);
GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 4, 2, 1, 2); SelectorWdg->GetButtonGroup()->addButton( SelectVectorButton );
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 5, 0, 1, 4); SelectorWdg->GetButtonGroup()->addButton( SelectPointButton );
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 6, 0, 1, 4);
/***************************************************************/ /***************************************************************/
GroupButtons = new QGroupBox(this); GroupButtons = new QGroupBox(this);
@ -274,7 +238,6 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
GroupButtonsLayout->addWidget(buttonHelp); GroupButtonsLayout->addWidget(buttonHelp);
/***************************************************************/ /***************************************************************/
SMESHGUI_RevolutionDlgLayout->addWidget(ConstructorsBox);
SMESHGUI_RevolutionDlgLayout->addWidget(GroupArguments); SMESHGUI_RevolutionDlgLayout->addWidget(GroupArguments);
SMESHGUI_RevolutionDlgLayout->addWidget(GroupButtons); SMESHGUI_RevolutionDlgLayout->addWidget(GroupButtons);
@ -294,23 +257,10 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
SpinBox_Tolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, "len_tol_precision"); SpinBox_Tolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.00001, "len_tol_precision");
RadioButton1->setChecked(true);
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
mySMESHGUI->SetActiveDialogBox((QDialog*)this); mySMESHGUI->SetActiveDialogBox((QDialog*)this);
// Costruction of the logical filter
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (SMESH::MESHorSUBMESH);
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (SMESH::GROUP);
QList<SUIT_SelectionFilter*> aListOfFilters;
if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
myMeshOrSubMeshOrGroupFilter =
new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
myHelpFileName = "revolution_page.html"; myHelpFileName = "revolution_page.html";
Init(); Init();
@ -326,9 +276,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(onSelectVectorButton())); connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(onSelectVectorButton()));
@ -336,16 +284,19 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
connect(SpinBox_Y, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation())); connect(SpinBox_Y, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(SpinBox_Z, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation())); connect(SpinBox_Z, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged())); connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(CheckIsEnable()));
connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged())); connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(CheckIsEnable()));
connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged())); connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(CheckIsEnable()));
connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument()));
connect(SelectorWdg, SIGNAL(selectionChanged()), this, SLOT(toDisplaySimulation()));
connect(SelectorWdg, SIGNAL(selectionChanged()), this, SLOT(CheckIsEnable()));
/* to close dialog if study change */ /* to close dialog if study change */
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject())); connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
connect(GroupAngle, SIGNAL(buttonClicked(int)), this, SLOT(toDisplaySimulation())); connect(GroupAngle, SIGNAL(buttonClicked(int)), this, SLOT(toDisplaySimulation()));
connect(SpinBox_Angle, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation())); connect(SpinBox_Angle, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
@ -357,8 +308,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
connect(SpinBox_Angle, SIGNAL(textChanged(const QString&)), this, SLOT(onAngleTextChange(const QString&))); connect(SpinBox_Angle, SIGNAL(textChanged(const QString&)), this, SLOT(onAngleTextChange(const QString&)));
ConstructorsClicked(0); CheckIsEnable();
SelectionIntoArgument();
} }
//================================================================================= //=================================================================================
@ -367,12 +317,6 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
//================================================================================= //=================================================================================
SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg() SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg()
{ {
delete mySimulation;
if ( myFilterDlg ) {
myFilterDlg->setParent( 0 );
delete myFilterDlg;
myFilterDlg = 0;
}
} }
//================================================================================= //=================================================================================
@ -381,17 +325,6 @@ SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg()
//================================================================================= //=================================================================================
void SMESHGUI_RevolutionDlg::Init (bool ResetControls) void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
{ {
myBusy = false;
myEditCurrentArgument = 0;
LineEditElements->clear();
myElementsId = "";
myNbOkElements = 0;
myIDs.clear();
myActor = 0;
myMesh = SMESH::SMESH_Mesh::_nil();
if (ResetControls) { if (ResetControls) {
SpinBox_X->SetValue(0.0); SpinBox_X->SetValue(0.0);
SpinBox_Y->SetValue(0.0); SpinBox_Y->SetValue(0.0);
@ -404,68 +337,51 @@ void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
SpinBox_NbSteps->setValue(1); SpinBox_NbSteps->setValue(1);
SpinBox_Tolerance->SetValue(1e-05); SpinBox_Tolerance->SetValue(1e-05);
CheckBoxMesh->setChecked(false);
onSelectMesh(false);
myPreviewCheckBox->setChecked(false); myPreviewCheckBox->setChecked(false);
onDisplaySimulation(false); onDisplaySimulation(false);
} }
SelectorWdg->Clear();
} }
//================================================================================= //=================================================================================
// function : ConstructorsClicked() // function : CheckIsEnable()
// purpose : Radio button management // purpose : Check whether the Ok and Apply buttons should be enabled or not
//================================================================================= //=================================================================================
void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
void SMESHGUI_RevolutionDlg::CheckIsEnable()
{
bool anIsEnable = SelectorWdg->IsAnythingSelected() && IsAxisOk();
buttonOk->setEnabled(anIsEnable);
buttonApply->setEnabled(anIsEnable);
}
//=================================================================================
// function : isValid
// purpose : Return true in case if values entered into dialog are valid
//=================================================================================
bool SMESHGUI_RevolutionDlg::isValid()
{ {
disconnect(mySelectionMgr, 0, this, 0); QString msg;
bool ok = true;
ok = SpinBox_X->isValid( msg, true ) && ok;
ok = SpinBox_Y->isValid( msg, true ) && ok;
ok = SpinBox_Z->isValid( msg, true ) && ok;
ok = SpinBox_DX->isValid( msg, true ) && ok;
ok = SpinBox_DY->isValid( msg, true ) && ok;
ok = SpinBox_DZ->isValid( msg, true ) && ok;
ok = SpinBox_Angle->isValid( msg, true ) && ok;
ok = SpinBox_NbSteps->isValid( msg, true ) && ok;
ok = SpinBox_Tolerance->isValid( msg, true ) && ok;
/* SALOME_ListIO io; if( !ok ) {
mySelectionMgr->selectedObjects( io ); QString str( tr( "SMESH_INCORRECT_INPUT" ) );
SALOME_ListIO aList; if ( !msg.isEmpty() )
mySelectionMgr->setSelectedObjects( aList );*/ str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
buttonApply->setEnabled(false); return false;
buttonOk->setEnabled(false);
mySimulation->SetVisibility(false);
Selection_Mode aSelMode = ActorSelection;
switch (constructorId) {
case 0:
{
GroupArguments->setTitle(tr("REVOLUTION_1D"));
aSelMode = EdgeSelection;
break;
}
case 1:
{
GroupArguments->setTitle(tr("REVOLUTION_2D"));
aSelMode = FaceSelection;
break;
}
} }
return true;
if (myEditCurrentArgument != (QWidget*)LineEditElements) {
SMESH::SetPointRepresentation(false);
}
if (!CheckBoxMesh->isChecked())
{
LineEditElements->clear();
myIDs.clear();
myNbOkElements = 0;
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(aSelMode);
}
myEditCurrentArgument = (QWidget*)LineEditElements;
LineEditElements->setFocus();
if (CheckBoxMesh->isChecked())
onSelectMesh(true);
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
// mySelectionMgr->setSelectedObjects( io );
} }
//================================================================================= //=================================================================================
@ -480,14 +396,7 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply()
if (!isValid()) if (!isValid())
return false; return false;
if (myNbOkElements && IsAxisOk()) { if ( SelectorWdg->IsAnythingSelected() && IsAxisOk() ) {
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
SMESH::long_array_var anElementsId = new SMESH::long_array;
anElementsId->length(aListElementsId.count());
for (int i = 0; i < aListElementsId.count(); i++)
anElementsId[i] = aListElementsId[i].toInt();
SMESH::AxisStruct anAxis; SMESH::AxisStruct anAxis;
@ -498,8 +407,8 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply()
anAxis.vy = SpinBox_DY->GetValue(); anAxis.vy = SpinBox_DY->GetValue();
anAxis.vz = SpinBox_DZ->GetValue(); anAxis.vz = SpinBox_DZ->GetValue();
double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.; double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.;
long aNbSteps = (long)SpinBox_NbSteps->value(); long aNbSteps = (long)SpinBox_NbSteps->value();
double aTolerance = SpinBox_Tolerance->GetValue(); double aTolerance = SpinBox_Tolerance->GetValue();
if ( GroupAngle->checkedId() == 1 ) if ( GroupAngle->checkedId() == 1 )
@ -517,75 +426,60 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply()
aParameters << SpinBox_Tolerance->text(); aParameters << SpinBox_Tolerance->text();
bool meshHadNewTypeBefore = true; bool meshHadNewTypeBefore = true;
int maxSelType = 0;
const bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
try { try {
SUIT_OverrideCursor aWaitCursor; SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_Mesh_var mesh = SelectorWdg->GetMesh();
mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
SMESH::ListOfIDSources_var nodes = new SMESH::ListOfIDSources();
SMESH::ListOfIDSources_var edges = new SMESH::ListOfIDSources();
SMESH::ListOfIDSources_var faces = new SMESH::ListOfIDSources();
maxSelType = SelectorWdg->GetSelected( nodes, edges, faces );
// is it necessary to switch on the next Display Mode? // is it necessary to switch on the next Display Mode?
SMESH::ElementType newType = (SMESH::ElementType)( SMESH::FACE + GetConstructorId() ); SMESH::ElementType newType = (SMESH::ElementType)( maxSelType + 1 );
SMESH::array_of_ElementType_var oldTypes = myMesh->GetTypes(); SMESH::array_of_ElementType_var oldTypes = mesh->GetTypes();
meshHadNewTypeBefore = false; meshHadNewTypeBefore = false;
for ( size_t i = 0; i < oldTypes->length() && !meshHadNewTypeBefore; ++i ) for ( size_t i = 0; i < oldTypes->length() && !meshHadNewTypeBefore; ++i )
meshHadNewTypeBefore = ( oldTypes[i] >= newType ); meshHadNewTypeBefore = ( oldTypes[i] >= newType );
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); SMESH::SMESH_MeshEditor_var aMeshEditor = mesh->GetMeshEditor();
myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) { SMESH::ListOfGroups_var groups =
if( CheckBoxMesh->isChecked() ) { aMeshEditor->RotationSweepObjects( nodes, edges, faces, anAxis,
if( GetConstructorId() == 0 ) anAngle, aNbSteps, aTolerance, makeGroups);
SMESH::ListOfGroups_var groups =
aMeshEditor->RotationSweepObject1DMakeGroups(mySelectedObject, anAxis,
anAngle, aNbSteps, aTolerance);
else
SMESH::ListOfGroups_var groups =
aMeshEditor->RotationSweepObject2DMakeGroups(mySelectedObject, anAxis,
anAngle, aNbSteps, aTolerance);
}
else
SMESH::ListOfGroups_var groups =
aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
anAngle, aNbSteps, aTolerance);
}
else {
if( CheckBoxMesh->isChecked() ) {
if( GetConstructorId() == 0 )
aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
else
aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
}
else
aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
}
} catch (...) { } catch (...) {
} }
if ( myActor && !meshHadNewTypeBefore ) SMESH_Actor* actor = SelectorWdg->GetActor();
if ( actor && !meshHadNewTypeBefore )
{ {
unsigned int aMode = myActor->GetEntityMode(); unsigned int aMode = actor->GetEntityMode();
switch ( GetConstructorId() ) { switch ( maxSelType ) {
case 0-1: // extrude node -> edges case SMESH::NODE: // extrude node -> edges
myActor->SetRepresentation(SMESH_Actor::eEdge); actor->SetRepresentation(SMESH_Actor::eEdge);
myActor->SetEntityMode( aMode |= SMESH_Actor::eEdges ); break; actor->SetEntityMode( aMode |= SMESH_Actor::eEdges ); break;
case 1-1: // edge -> faces case SMESH::EDGE: // edge -> faces
myActor->SetRepresentation(SMESH_Actor::eSurface); actor->SetRepresentation(SMESH_Actor::eSurface);
myActor->SetEntityMode( aMode |= SMESH_Actor::eFaces ); break; actor->SetEntityMode( aMode |= SMESH_Actor::eFaces ); break;
case 2-1: // faces -> volumes case SMESH::FACE: // faces -> volumes
myActor->SetRepresentation(SMESH_Actor::eSurface); actor->SetRepresentation(SMESH_Actor::eSurface);
myActor->SetEntityMode( aMode |= SMESH_Actor::eVolumes ); break; actor->SetEntityMode( aMode |= SMESH_Actor::eVolumes ); break;
} }
} }
SMESH::UpdateView(); if ( actor )
SMESH::Update(myIO, SMESH::eDisplay); SMESH::Update( actor->getIO(), actor->GetVisibility() );
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) if ( makeGroups )
mySMESHGUI->updateObjBrowser(true); // new groups may appear mySMESHGUI->updateObjBrowser(true); // new groups may appear
Init(false); Init(false);
mySelectionMgr->clearSelected(); mySelectionMgr->clearSelected();
mySelectedObject = SMESH::SMESH_IDSource::_nil(); SelectorWdg->Clear();
SelectionIntoArgument();
ConstructorsClicked(GetConstructorId());
SMESHGUI::Modified(); SMESHGUI::Modified();
} }
@ -660,159 +554,50 @@ void SMESHGUI_RevolutionDlg::onAngleTextChange (const QString& theNewText)
RadioButton4->setEnabled( isNumber ); RadioButton4->setEnabled( isNumber );
} }
//=======================================================================
// function : onTextChange()
// purpose :
//=======================================================================
void SMESHGUI_RevolutionDlg::onTextChange (const QString& theNewText)
{
QLineEdit* send = (QLineEdit*)sender();
if (myBusy) return;
myBusy = true;
if (send == LineEditElements)
myNbOkElements = 0;
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);
// hilight entered elements
SMDS_Mesh* aMesh = 0;
if (myActor)
aMesh = myActor->GetObject()->GetMesh();
if (aMesh) {
if (send == LineEditElements) {
Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
TColStd_MapOfInteger newIndices;
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++) {
const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
if (e)
newIndices.Add(e->GetID());
myNbOkElements++;
}
mySelector->AddOrRemoveIndex(myActor->getIO(), newIndices, false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight( myActor->getIO(), true, true );
myElementsId = theNewText;
}
}
if (myNbOkElements && IsAxisOk()) {
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
}
onDisplaySimulation(true);
myBusy = false;
}
//================================================================================= //=================================================================================
// function : SelectionIntoArgument() // function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case // purpose : Called when selection as changed or other case
//================================================================================= //=================================================================================
void SMESHGUI_RevolutionDlg::SelectionIntoArgument() void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
{ {
if (myBusy) return;
// clear
QString aString = "";
myBusy = true;
if (myEditCurrentArgument == (QWidget*)LineEditElements) {
LineEditElements->setText(aString);
myNbOkElements = 0;
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);
}
myBusy = false;
if (!GroupButtons->isEnabled()) // inactive if (!GroupButtons->isEnabled()) // inactive
return; return;
// get selected mesh if ( SelectVectorButton->isChecked() ||
SALOME_ListIO aList; SelectPointButton->isChecked() )
mySelectionMgr->selectedObjects(aList); {
int nbSel = aList.Extent(); // get selected mesh
if (nbSel != 1) SALOME_ListIO aList;
return; mySelectionMgr->selectedObjects(aList);
int nbSel = aList.Extent();
Handle(SALOME_InteractiveObject) IO = aList.First(); if (nbSel != 1)
SMESH::SMESH_Mesh_var aMeshVar = SMESH::GetMeshByIO(IO);
if (aMeshVar->_is_nil())
return;
SMESH_Actor* anActor = SMESH::FindActorByObject(aMeshVar);
if (!anActor)
anActor = SMESH::FindActorByEntry(IO->getEntry());
if (!anActor && !CheckBoxMesh->isChecked())
return;
int aNbUnits = 0;
if (myEditCurrentArgument == (QWidget*)LineEditElements) {
myElementsId = "";
myMesh = aMeshVar;
myActor = anActor;
myIO = IO;
// MakeGroups is available if there are groups
if ( myMesh->NbGroups() == 0 ) {
MakeGroupsCheck->setChecked(false);
MakeGroupsCheck->setEnabled(false);
} else {
MakeGroupsCheck->setEnabled(true);
}
if (CheckBoxMesh->isChecked()) {
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
else
return;
} else {
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
myElementsId = aString;
if (aNbUnits < 1)
return;
}
myNbOkElements = true;
} else {
SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
if (!aMesh)
return; return;
Handle(SALOME_InteractiveObject) IO = aList.First();
TColStd_IndexedMapOfInteger aMapIndex;
mySelector->GetIndex(IO,aMapIndex);
if ( aMapIndex.Extent() != 1 )
return;
SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
SMDS_Mesh* aMesh = anActor ? anActor->GetObject()->GetMesh() : 0;
if ( !aMesh )
return;
int aNbUnits = 0;
bool isNodeSelected = (myEditCurrentArgument == (QWidget*)SpinBox_X || bool isNodeSelected = (myEditCurrentArgument == (QWidget*)SpinBox_X ||
(myEditCurrentArgument == (QWidget*)SpinBox_DX && (myEditCurrentArgument == (QWidget*)SpinBox_DX &&
myVectorDefinition==POINT_SELECT)); myVectorDefinition==POINT_SELECT));
bool isFaceSelected = (myEditCurrentArgument == (QWidget*)SpinBox_DX && bool isFaceSelected = (myEditCurrentArgument == (QWidget*)SpinBox_DX &&
myVectorDefinition==FACE_SELECT); myVectorDefinition==FACE_SELECT);
if(isNodeSelected) { if ( isNodeSelected )
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString); {
} const SMDS_MeshNode * n = aMesh->FindNode( aMapIndex(1) );
else if(isFaceSelected){
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
}
if (aNbUnits != 1)
return;
if(isNodeSelected) {
const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
if (!n) if (!n)
return; return;
double x = n->X(); double x = n->X();
double y = n->Y(); double y = n->Y();
double z = n->Z(); double z = n->Z();
@ -827,30 +612,21 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue()); SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
} }
} }
else if(isFaceSelected){ else if ( isFaceSelected )
const SMDS_MeshFace* face = dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aString.toInt())); {
const SMDS_MeshFace* face =
dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aMapIndex(1)));
if (!face) if (!face)
return; return;
gp_XYZ aNormale = SMESH::getNormale(face); gp_XYZ aNormale = SMESH::getNormale(face);
SpinBox_DX->SetValue(aNormale.X()); SpinBox_DX->SetValue(aNormale.X());
SpinBox_DY->SetValue(aNormale.Y()); SpinBox_DY->SetValue(aNormale.Y());
SpinBox_DZ->SetValue(aNormale.Z()); SpinBox_DZ->SetValue(aNormale.Z());
} }
} }
myBusy = true; CheckIsEnable();
if (myEditCurrentArgument == (QWidget*)LineEditElements)
LineEditElements->setText(aString);
myBusy = false;
// OK
if (myNbOkElements && IsAxisOk()) {
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
}
onDisplaySimulation(true); onDisplaySimulation(true);
} }
@ -866,35 +642,13 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
mySelectionMgr->clearSelected(); mySelectionMgr->clearSelected();
mySelectionMgr->clearFilters(); mySelectionMgr->clearFilters();
if (send == SelectElementsButton) { if (send == SelectPointButton) {
mySimulation->SetVisibility(false);
myEditCurrentArgument = (QWidget*)LineEditElements;
SMESH::SetPointRepresentation(false);
if (CheckBoxMesh->isChecked()) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
} else {
int aConstructorId = GetConstructorId();
if (aConstructorId == 0)
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(EdgeSelection);
}
else if (aConstructorId == 1)
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(FaceSelection);
}
}
} else if (send == SelectPointButton) {
myEditCurrentArgument = (QWidget*)SpinBox_X; myEditCurrentArgument = (QWidget*)SpinBox_X;
myEditCurrentArgument->setFocus();
SMESH::SetPointRepresentation(true); SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(NodeSelection); aViewWindow->SetSelectionMode(NodeSelection);
} }
myEditCurrentArgument->setFocus();
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
SelectionIntoArgument(); SelectionIntoArgument();
} }
@ -905,10 +659,11 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
//================================================================================= //=================================================================================
void SMESHGUI_RevolutionDlg::DeactivateActiveDialog() void SMESHGUI_RevolutionDlg::DeactivateActiveDialog()
{ {
if (ConstructorsBox->isEnabled()) { if (GroupButtons->isEnabled())
ConstructorsBox->setEnabled(false); {
GroupArguments->setEnabled(false); GroupArguments->setEnabled(false);
GroupButtons->setEnabled(false); GroupButtons->setEnabled(false);
SelectorWdg->setEnabled(false);
mySMESHGUI->ResetState(); mySMESHGUI->ResetState();
mySMESHGUI->SetActiveDialogBox(0); mySMESHGUI->SetActiveDialogBox(0);
} }
@ -922,14 +677,11 @@ void SMESHGUI_RevolutionDlg::ActivateThisDialog()
{ {
/* Emit a signal to deactivate the active dialog */ /* Emit a signal to deactivate the active dialog */
mySMESHGUI->EmitSignalDeactivateDialog(); mySMESHGUI->EmitSignalDeactivateDialog();
ConstructorsBox->setEnabled(true);
GroupArguments->setEnabled(true); GroupArguments->setEnabled(true);
GroupButtons->setEnabled(true); GroupButtons->setEnabled(true);
SelectorWdg->setEnabled(true);
mySMESHGUI->SetActiveDialogBox((QDialog*)this); mySMESHGUI->SetActiveDialogBox((QDialog*)this);
ConstructorsClicked(GetConstructorId());
SelectionIntoArgument();
} }
//================================================================================= //=================================================================================
@ -938,73 +690,10 @@ void SMESHGUI_RevolutionDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void SMESHGUI_RevolutionDlg::enterEvent (QEvent*) void SMESHGUI_RevolutionDlg::enterEvent (QEvent*)
{ {
if (!ConstructorsBox->isEnabled()) if (!GroupButtons->isEnabled())
ActivateThisDialog(); ActivateThisDialog();
} }
//=======================================================================
//function : onSelectMesh
//purpose :
//=======================================================================
void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh)
{
if (toSelectMesh) {
myIDs = LineEditElements->text();
TextLabelElements->setText(tr("SMESH_NAME"));
}
else
TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
myFilterBtn->setEnabled(!toSelectMesh);
if (myEditCurrentArgument != LineEditElements) {
LineEditElements->clear();
mySimulation->SetVisibility(false);
return;
}
mySelectionMgr->clearFilters();
SMESH::SetPointRepresentation(false);
if (toSelectMesh) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
LineEditElements->setReadOnly(true);
LineEditElements->setValidator(0);
} else {
int aConstructorId = GetConstructorId();
if (aConstructorId == 0)
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(EdgeSelection);
}
else if (aConstructorId == 1)
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(FaceSelection);
}
LineEditElements->setReadOnly(false);
LineEditElements->setValidator(myIdValidator);
onTextChange(LineEditElements->text());
mySimulation->SetVisibility(false);
}
SelectionIntoArgument();
if (!toSelectMesh)
LineEditElements->setText( myIDs );
}
//=================================================================================
// function : GetConstructorId()
// purpose :
//=================================================================================
int SMESHGUI_RevolutionDlg::GetConstructorId()
{
return GroupConstructors->checkedId();
}
//================================================================================= //=================================================================================
// function : IsAxisOk() // function : IsAxisOk()
// purpose : // purpose :
@ -1016,22 +705,6 @@ bool SMESHGUI_RevolutionDlg::IsAxisOk()
SpinBox_DZ->GetValue() != 0); SpinBox_DZ->GetValue() != 0);
} }
//=================================================================================
// function : onVectorChanged()
// purpose :
//=================================================================================
void SMESHGUI_RevolutionDlg::onVectorChanged()
{
if (IsAxisOk()) {
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
} else {
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);
}
onDisplaySimulation(true);
}
//================================================================================= //=================================================================================
// function : keyPressEvent() // function : keyPressEvent()
// purpose : // purpose :
@ -1056,17 +729,8 @@ void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
{ {
if (myPreviewCheckBox->isChecked() && toDisplayPreview) if (myPreviewCheckBox->isChecked() && toDisplayPreview)
{ {
//display preview if (SelectorWdg->IsAnythingSelected() && IsAxisOk())
if (myNbOkElements && IsAxisOk())
{ {
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
SMESH::long_array_var anElementsId = new SMESH::long_array;
anElementsId->length(aListElementsId.count());
for (int i = 0; i < aListElementsId.count(); i++)
anElementsId[i] = aListElementsId[i].toInt();
SMESH::AxisStruct anAxis; SMESH::AxisStruct anAxis;
anAxis.x = SpinBox_X->GetValue(); anAxis.x = SpinBox_X->GetValue();
@ -1076,33 +740,34 @@ void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
anAxis.vy = SpinBox_DY->GetValue(); anAxis.vy = SpinBox_DY->GetValue();
anAxis.vz = SpinBox_DZ->GetValue(); anAxis.vz = SpinBox_DZ->GetValue();
double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.; double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.;
long aNbSteps = (long)SpinBox_NbSteps->value(); long aNbSteps = (long)SpinBox_NbSteps->value();
double aTolerance = SpinBox_Tolerance->GetValue(); double aTolerance = SpinBox_Tolerance->GetValue();
if (GroupAngle->checkedId() == 1) if (GroupAngle->checkedId() == 1)
anAngle = anAngle/aNbSteps; anAngle = anAngle/aNbSteps;
try { try
{
SUIT_OverrideCursor aWaitCursor; SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
if( CheckBoxMesh->isChecked() ) { SMESH::SMESH_Mesh_var mesh = SelectorWdg->GetMesh();
if( GetConstructorId() == 0 ) SMESH::SMESH_MeshEditor_var meshEditor = mesh->GetMeshEditPreviewer();
aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis, SMESH::ListOfGroups_var groups;
anAngle, aNbSteps, aTolerance);
else SMESH::ListOfIDSources_var nodes = new SMESH::ListOfIDSources();
aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis, SMESH::ListOfIDSources_var edges = new SMESH::ListOfIDSources();
anAngle, aNbSteps, aTolerance); SMESH::ListOfIDSources_var faces = new SMESH::ListOfIDSources();
} SelectorWdg->GetSelected( nodes, edges, faces );
else const bool makeGroups = false;
aMeshEditor->RotationSweep(anElementsId.inout(),
anAxis, meshEditor->RotationSweepObjects(nodes, edges, faces,
anAngle, anAxis, anAngle, aNbSteps, aTolerance, makeGroups );
aNbSteps,
aTolerance); SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData();
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData(); mySimulation->SetData( aMeshPreviewStruct._retn() );
mySimulation->SetData(aMeshPreviewStruct._retn()); }
} catch (...) {} catch (...) {}
} }
else else
{ {
@ -1120,7 +785,8 @@ void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
// function : onSelectVectorButton() // function : onSelectVectorButton()
// purpose : [slot] // purpose : [slot]
//================================================================================= //=================================================================================
void SMESHGUI_RevolutionDlg::onSelectVectorButton(){ void SMESHGUI_RevolutionDlg::onSelectVectorButton()
{
if(SelectVectorMenu) { if(SelectVectorMenu) {
SelectVectorMenu->exec( QCursor::pos() ); SelectVectorMenu->exec( QCursor::pos() );
} }
@ -1130,7 +796,8 @@ void SMESHGUI_RevolutionDlg::onSelectVectorButton(){
// function : onSelectVectorMenu() // function : onSelectVectorMenu()
// purpose : [slot] // purpose : [slot]
//================================================================================= //=================================================================================
void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action){ void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action)
{
if(!action) if(!action)
return; return;
@ -1157,58 +824,4 @@ void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action){
SelectionIntoArgument(); SelectionIntoArgument();
} }
//=================================================================================
// function : setFilters()
// purpose : SLOT. Called when "Filter" button pressed.
//=================================================================================
void SMESHGUI_RevolutionDlg::setFilters()
{
if(myMesh->_is_nil()) {
SUIT_MessageBox::critical(this,
tr("SMESH_ERROR"),
tr("NO_MESH_SELECTED"));
return;
}
if ( !myFilterDlg )
{
QList<int> types;
types.append( SMESH::EDGE );
types.append( SMESH::FACE );
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
}
myFilterDlg->Init( GetConstructorId() ? SMESH::FACE : SMESH::EDGE );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSourceWg( LineEditElements );
myFilterDlg->show();
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
bool SMESHGUI_RevolutionDlg::isValid()
{
QString msg;
bool ok = true;
ok = SpinBox_X->isValid( msg, true ) && ok;
ok = SpinBox_Y->isValid( msg, true ) && ok;
ok = SpinBox_Z->isValid( msg, true ) && ok;
ok = SpinBox_DX->isValid( msg, true ) && ok;
ok = SpinBox_DY->isValid( msg, true ) && ok;
ok = SpinBox_DZ->isValid( msg, true ) && ok;
ok = SpinBox_Angle->isValid( msg, true ) && ok;
ok = SpinBox_NbSteps->isValid( msg, true ) && ok;
ok = SpinBox_Tolerance->isValid( msg, true ) && ok;
if( !ok ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return false;
}
return true;
}

View File

@ -41,26 +41,27 @@
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Mesh)
class LightApp_SelectionMgr;
class QAction;
class QButtonGroup; class QButtonGroup;
class QCheckBox;
class QGroupBox; class QGroupBox;
class QLabel; class QLabel;
class QLineEdit; class QLineEdit;
class QMenu;
class QPushButton; class QPushButton;
class QRadioButton; class QRadioButton;
class QCheckBox;
class SalomeApp_IntSpinBox;
class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox;
class SMESHGUI;
class SMESHGUI_FilterDlg;
class SMESH_Actor;
class SVTK_Selector;
class LightApp_SelectionMgr;
class SMESH_LogicalFilter;
class SALOME_Actor; class SALOME_Actor;
class SMESHGUI;
class SMESHGUI_3TypesSelector;
class SMESHGUI_FilterDlg;
class SMESHGUI_IdValidator;
class SMESHGUI_MeshEditPreview; class SMESHGUI_MeshEditPreview;
class QMenu; class SMESHGUI_SpinBox;
class QAction; class SMESH_Actor;
class SMESH_LogicalFilter;
class SVTK_Selector;
class SalomeApp_IntSpinBox;
//================================================================================= //=================================================================================
// class : SMESHGUI_RevolutionDlg // class : SMESHGUI_RevolutionDlg
@ -85,27 +86,11 @@ private:
bool isValid(); bool isValid();
SMESHGUI_IdValidator* myIdValidator;
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
int myNbOkElements; /* to check when elements are defined */
QString myElementsId;
QWidget* myEditCurrentArgument; /* Current argument */
SVTK_Selector* mySelector; SVTK_Selector* mySelector;
Handle(SALOME_InteractiveObject) myIO; QWidget* myEditCurrentArgument; /* Current argument */
SMESH::SMESH_IDSource_var mySelectedObject;
bool myBusy; SMESHGUI_3TypesSelector* SelectorWdg;
SMESH::SMESH_Mesh_var myMesh;
SMESH_Actor* myActor;
SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter;
SMESHGUI_MeshEditPreview* mySimulation;
SALOME_Actor* myPreviewActor;
QGroupBox* ConstructorsBox;
QButtonGroup* GroupConstructors;
QRadioButton* RadioButton1;
QRadioButton* RadioButton2;
QGroupBox* GroupButtons; QGroupBox* GroupButtons;
QPushButton* buttonOk; QPushButton* buttonOk;
QPushButton* buttonCancel; QPushButton* buttonCancel;
@ -113,10 +98,6 @@ private:
QPushButton* buttonHelp; QPushButton* buttonHelp;
QGroupBox* GroupArguments; QGroupBox* GroupArguments;
QGroupBox* GroupAxis; QGroupBox* GroupAxis;
QLabel* TextLabelElements;
QPushButton* SelectElementsButton;
QLineEdit* LineEditElements;
QCheckBox* CheckBoxMesh;
QCheckBox* MakeGroupsCheck; QCheckBox* MakeGroupsCheck;
QGroupBox* GroupAngleBox; QGroupBox* GroupAngleBox;
QButtonGroup* GroupAngle; QButtonGroup* GroupAngle;
@ -153,17 +134,13 @@ private:
QString myHelpFileName; QString myHelpFileName;
QString myIDs;
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
protected slots: protected slots:
virtual void onDisplaySimulation( bool ); virtual void onDisplaySimulation( bool );
virtual void reject(); virtual void reject();
private slots: private slots:
void ConstructorsClicked( int ); void CheckIsEnable();
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void ClickOnHelp(); void ClickOnHelp();
@ -171,13 +148,9 @@ private slots:
void SelectionIntoArgument(); void SelectionIntoArgument();
void DeactivateActiveDialog(); void DeactivateActiveDialog();
void ActivateThisDialog(); void ActivateThisDialog();
void onTextChange( const QString& );
void onAngleTextChange( const QString& ); void onAngleTextChange( const QString& );
void onSelectMesh( bool );
void onVectorChanged();
void onSelectVectorMenu( QAction* ); void onSelectVectorMenu( QAction* );
void onSelectVectorButton(); void onSelectVectorButton();
void setFilters();
}; };
#endif // SMESHGUI_REVOLUTIONDLG_H #endif // SMESHGUI_REVOLUTIONDLG_H

View File

@ -486,7 +486,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
} }
else { else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
SMESH::SMESH_IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL); SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL);
myMeshes[0]->SetParameters( aParameters.join( ":" ).toLatin1().constData() ); myMeshes[0]->SetParameters( aParameters.join( ":" ).toLatin1().constData() );
aMeshEditor->Scale( src, aPoint, aScaleFact, false); aMeshEditor->Scale( src, aPoint, aScaleFact, false);
} }
@ -503,7 +503,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
} }
else { else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
SMESH::SMESH_IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL); SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL);
myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData()); myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
groups = aMeshEditor->ScaleMakeGroups( src, aPoint, aScaleFact); groups = aMeshEditor->ScaleMakeGroups( src, aPoint, aScaleFact);
} }
@ -518,7 +518,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
} }
else { else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
SMESH::SMESH_IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL); SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL);
myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData()); myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
aMeshEditor->Scale( src, aPoint, aScaleFact, true); aMeshEditor->Scale( src, aPoint, aScaleFact, true);
} }
@ -541,7 +541,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
else { else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData()); myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
SMESH::SMESH_IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL); SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL);
mesh = aMeshEditor->ScaleMakeMesh( src, aPoint, aScaleFact, makeGroups, mesh = aMeshEditor->ScaleMakeMesh( src, aPoint, aScaleFact, makeGroups,
LineEditNewMesh->text().toLatin1().data()); LineEditNewMesh->text().toLatin1().data());
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
@ -1147,7 +1147,7 @@ void SMESHGUI_ScaleDlg::onDisplaySimulation( bool toDisplayPreview ) {
} }
else { else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer();
SMESH::SMESH_IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL); SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL);
aMeshEditor->Scale( src, aPoint, aScaleFact, copy); aMeshEditor->Scale( src, aPoint, aScaleFact, copy);
aMeshPreviewStruct << aMeshEditor->GetPreviewData(); aMeshPreviewStruct << aMeshEditor->GetPreviewData();
} }

View File

@ -182,7 +182,7 @@ SMESHGUI_EXPORT
// type to use instead of SMESH_IDSource_var for automatic UnRegister() // type to use instead of SMESH_IDSource_var for automatic UnRegister()
typedef SALOME::GenericObj_wrap<SMESH_IDSource> SMESH_IDSource_wrap; typedef SALOME::GenericObj_wrap<SMESH_IDSource> IDSource_wrap;
/*! /*!
* \brief Class usefull to convert a string returned from a CORBA call * \brief Class usefull to convert a string returned from a CORBA call

View File

@ -286,7 +286,7 @@
</message> </message>
<message> <message>
<source>MEN_MESH_ORDER</source> <source>MEN_MESH_ORDER</source>
<translation>Change submesh priority</translation> <translation>Change sub-mesh priority</translation>
</message> </message>
<message> <message>
<source>MEN_CREATE_GROUP</source> <source>MEN_CREATE_GROUP</source>
@ -1287,7 +1287,7 @@ Please enter correct values and try again</translation>
</message> </message>
<message> <message>
<source>SMESH_ADD_SUBMESH</source> <source>SMESH_ADD_SUBMESH</source>
<translation>SubMesh Construction</translation> <translation>Sub-mesh Construction</translation>
</message> </message>
<message> <message>
<source>SMESH_ADD_TETRAS</source> <source>SMESH_ADD_TETRAS</source>
@ -1805,7 +1805,7 @@ add the exported data to its contents?</translation>
</message> </message>
<message> <message>
<source>SMESH_HYP_10</source> <source>SMESH_HYP_10</source>
<translation>Hypothesis and submesh dimensions mismatch</translation> <translation>Hypothesis and sub-mesh dimensions mismatch</translation>
</message> </message>
<message> <message>
<source>SMESH_HYP_11</source> <source>SMESH_HYP_11</source>
@ -1830,7 +1830,7 @@ Check algorithm documentation for supported geometry</translation>
</message> </message>
<message> <message>
<source>SMESH_HYP_4</source> <source>SMESH_HYP_4</source>
<translation>Submesh is ignored as there is another algorithm of upper dimension generating %1D elements</translation> <translation>Sub-mesh is ignored as there is another algorithm of upper dimension generating %1D elements</translation>
</message> </message>
<message> <message>
<source>SMESH_HYP_5</source> <source>SMESH_HYP_5</source>
@ -1853,20 +1853,20 @@ Check algorithm documentation for supported geometry</translation>
<translation>Such dimention hypothesis is already assigned to the shape</translation> <translation>Such dimention hypothesis is already assigned to the shape</translation>
</message> </message>
<message> <message>
<source>SMESH_ID_DIAGONAL</source> <source>SMESH_ID_EDGES</source>
<translation>Id Edges</translation> <translation>Edge IDs</translation>
</message> </message>
<message> <message>
<source>SMESH_ID_ELEMENTS</source> <source>SMESH_ID_ELEMENTS</source>
<translation>Id Elements</translation> <translation>Element IDs</translation>
</message> </message>
<message> <message>
<source>SMESH_ID_FACES</source> <source>SMESH_ID_FACES</source>
<translation>Id Faces</translation> <translation>Face IDs</translation>
</message> </message>
<message> <message>
<source>SMESH_ID_NODES</source> <source>SMESH_ID_NODES</source>
<translation>Id Nodes</translation> <translation>Node IDs</translation>
</message> </message>
<message> <message>
<source>SMESH_INCORRECT_INPUT</source> <source>SMESH_INCORRECT_INPUT</source>
@ -1938,23 +1938,23 @@ Check algorithm documentation for supported geometry</translation>
</message> </message>
<message> <message>
<source>SMESH_MEN_SubMeshesOnCompound</source> <source>SMESH_MEN_SubMeshesOnCompound</source>
<translation>SubMeshes On Compound</translation> <translation>Sub-meshes On Compound</translation>
</message> </message>
<message> <message>
<source>SMESH_MEN_SubMeshesOnEdge</source> <source>SMESH_MEN_SubMeshesOnEdge</source>
<translation>SubMeshes On Edge</translation> <translation>Sub-meshes On Edge</translation>
</message> </message>
<message> <message>
<source>SMESH_MEN_SubMeshesOnFace</source> <source>SMESH_MEN_SubMeshesOnFace</source>
<translation>SubMeshes On Face</translation> <translation>Sub-meshes On Face</translation>
</message> </message>
<message> <message>
<source>SMESH_MEN_SubMeshesOnSolid</source> <source>SMESH_MEN_SubMeshesOnSolid</source>
<translation>SubMeshes On Solid</translation> <translation>Sub-meshes On Solid</translation>
</message> </message>
<message> <message>
<source>SMESH_MEN_SubMeshesOnVertex</source> <source>SMESH_MEN_SubMeshesOnVertex</source>
<translation>SubMeshes On Vertex</translation> <translation>Sub-meshes On Vertex</translation>
</message> </message>
<message> <message>
<source>SMESH_AUTOMATIC</source> <source>SMESH_AUTOMATIC</source>
@ -2168,9 +2168,13 @@ Check algorithm documentation for supported geometry</translation>
<source>SMESH_OBJECT_MESH</source> <source>SMESH_OBJECT_MESH</source>
<translation>Mesh</translation> <translation>Mesh</translation>
</message> </message>
<message>
<source>SMESH_OBJECTS</source>
<translation>Objects</translation>
</message>
<message> <message>
<source>SMESH_OBJECT_MESHorSUBMESH</source> <source>SMESH_OBJECT_MESHorSUBMESH</source>
<translation>Mesh or SubMesh</translation> <translation>Mesh or Sub-mesh</translation>
</message> </message>
<message> <message>
<source>SMESH_OPERATION_FAILED</source> <source>SMESH_OPERATION_FAILED</source>
@ -2587,11 +2591,11 @@ Check algorithm documentation for supported geometry</translation>
</message> </message>
<message> <message>
<source>SMESH_SUBMESH</source> <source>SMESH_SUBMESH</source>
<translation>SubMesh</translation> <translation>Sub-mesh</translation>
</message> </message>
<message> <message>
<source>SMESH_SUBMESH_SELECTED</source> <source>SMESH_SUBMESH_SELECTED</source>
<translation>%1 SubMeshes</translation> <translation>%1 Sub-meshes</translation>
</message> </message>
<message> <message>
<source>SMESH_SYMMETRY</source> <source>SMESH_SYMMETRY</source>
@ -2914,7 +2918,7 @@ Use Display Entity menu command to show them.
</message> </message>
<message> <message>
<source>STB_MESH_ORDER</source> <source>STB_MESH_ORDER</source>
<translation>Change submesh priority</translation> <translation>Change sub-mesh priority</translation>
</message> </message>
<message> <message>
<source>STB_CREATE_GROUP</source> <source>STB_CREATE_GROUP</source>
@ -3574,7 +3578,7 @@ Use Display Entity menu command to show them.
</message> </message>
<message> <message>
<source>TOP_MESH_ORDER</source> <source>TOP_MESH_ORDER</source>
<translation>Change submesh priority</translation> <translation>Change sub-mesh priority</translation>
</message> </message>
<message> <message>
<source>TOP_CREATE_GROUP</source> <source>TOP_CREATE_GROUP</source>
@ -4833,9 +4837,9 @@ Please, create VTK viewer and try again</translation>
<name>SMESHGUI_PrecomputeOp</name> <name>SMESHGUI_PrecomputeOp</name>
<message> <message>
<source>CLEAR_SUBMESH_QUESTION</source> <source>CLEAR_SUBMESH_QUESTION</source>
<translation>Temporary submeshes on the selected geometry <translation>Temporary sub-meshes on the selected geometry
were created during preview operation. were created during preview operation.
Do you want to remove all these submeshes?</translation> Do you want to remove all these sub-meshes?</translation>
</message> </message>
<message> <message>
<source>SMESH_WRN_NOTHING_PREVIEW</source> <source>SMESH_WRN_NOTHING_PREVIEW</source>
@ -4843,8 +4847,8 @@ Do you want to remove all these submeshes?</translation>
</message> </message>
<message> <message>
<source>SMESH_REJECT_MESH_ORDER</source> <source>SMESH_REJECT_MESH_ORDER</source>
<translation>The submesh priority changed during preview operation. <translation>The sub-mesh priority changed during preview operation.
Do you want to restore original submesh priority?</translation> Do you want to restore original sub-mesh priority?</translation>
</message> </message>
</context> </context>
<context> <context>
@ -4940,7 +4944,7 @@ Please verify validity of entered information</translation>
</message> </message>
<message> <message>
<source>MESH_OR_SUBMESH</source> <source>MESH_OR_SUBMESH</source>
<translation>Mesh or SubMesh</translation> <translation>Mesh or Sub-mesh</translation>
</message> </message>
<message> <message>
<source>PATTERN</source> <source>PATTERN</source>
@ -5104,7 +5108,7 @@ Please select a group and try again</translation>
</message> </message>
<message> <message>
<source>SMESH_PATH_MESH</source> <source>SMESH_PATH_MESH</source>
<translation>Mesh or submesh</translation> <translation>Mesh or sub-mesh</translation>
</message> </message>
<message> <message>
<source>SMESH_PATH_SHAPE</source> <source>SMESH_PATH_SHAPE</source>
@ -6034,12 +6038,12 @@ Please specify them and try again</translation>
</message> </message>
<message> <message>
<source>EDIT_SUBMESH_QUESTION</source> <source>EDIT_SUBMESH_QUESTION</source>
<translation>A submesh on the selected geometry already exists. <translation>A sub-mesh on the selected geometry already exists.
Do you want to edit this submesh?</translation> Do you want to edit this sub-mesh?</translation>
</message> </message>
<message> <message>
<source>SUBMESH_NOT_ALLOWED</source> <source>SUBMESH_NOT_ALLOWED</source>
<translation>No sense in creating a submesh ignored by global algorithm &quot;%1&quot;</translation> <translation>No sense in creating a sub-mesh ignored by global algorithm &quot;%1&quot;</translation>
</message> </message>
<message> <message>
<source>GEOMETRY_OBJECT_IS_NOT_DEFINED_MESH</source> <source>GEOMETRY_OBJECT_IS_NOT_DEFINED_MESH</source>
@ -6108,7 +6112,7 @@ Please enter valid name and try again</translation>
</message> </message>
<message> <message>
<source>NAME_OF_SUBMESH_IS_EMPTY</source> <source>NAME_OF_SUBMESH_IS_EMPTY</source>
<translation>Name of submesh is empty <translation>Name of sub-mesh is empty
Please enter valid name and try again</translation> Please enter valid name and try again</translation>
</message> </message>
<message> <message>
@ -6415,8 +6419,8 @@ It is impossible to read point coordinates from file</translation>
<translation>Preview</translation> <translation>Preview</translation>
</message> </message>
<message> <message>
<source>REVOLUTION_1D</source> <source>REVOLUTION</source>
<translation>Revolution of 1D elements</translation> <translation>Revolution</translation>
</message> </message>
<message> <message>
<source>REVOLUTION_2D</source> <source>REVOLUTION_2D</source>
@ -6650,14 +6654,14 @@ It is impossible to read point coordinates from file</translation>
<name>SMESHGUI_MeshOrderDlg</name> <name>SMESHGUI_MeshOrderDlg</name>
<message> <message>
<source>SMESH_MESHORDER_TITLE</source> <source>SMESH_MESHORDER_TITLE</source>
<translation>Order of submesh in meshing process</translation> <translation>Order of sub-mesh in meshing process</translation>
</message> </message>
</context> </context>
<context> <context>
<name>SMESHGUI_MeshOrderOp</name> <name>SMESHGUI_MeshOrderOp</name>
<message> <message>
<source>SMESH_NO_CONCURENT_MESH</source> <source>SMESH_NO_CONCURENT_MESH</source>
<translation>No concurent submeshes detected</translation> <translation>No concurent sub-meshes detected</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -80,7 +80,7 @@ namespace SMESHUtils
struct Deleter struct Deleter
{ {
TOBJ* _obj; TOBJ* _obj;
Deleter( TOBJ* obj ): _obj( obj ) {} Deleter( TOBJ* obj = (TOBJ*)NULL ): _obj( obj ) {}
~Deleter() { delete _obj; _obj = 0; } ~Deleter() { delete _obj; _obj = 0; }
private: private:
Deleter( const Deleter& ); Deleter( const Deleter& );

View File

@ -384,6 +384,7 @@ namespace {
"ExtrusionSweepObjectMakeGroups","ExtrusionSweepObject0D", "ExtrusionSweepObjectMakeGroups","ExtrusionSweepObject0D",
"ExtrusionSweepObject1D","ExtrusionSweepObject1DMakeGroups", "ExtrusionSweepObject1D","ExtrusionSweepObject1DMakeGroups",
"ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups", "ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups",
"ExtrusionSweepObjects","RotationSweepObjects","ExtrusionAlongPathObjects",
"Translate","TranslateMakeGroups","TranslateMakeMesh", "Translate","TranslateMakeGroups","TranslateMakeMesh",
"TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh", "TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh",
"ExtrusionAlongPathX","ExtrusionAlongPathObjX","SplitHexahedraIntoPrisms" "ExtrusionAlongPathX","ExtrusionAlongPathObjX","SplitHexahedraIntoPrisms"
@ -431,7 +432,8 @@ namespace {
"ExportCGNS","ExportGMF", "ExportCGNS","ExportGMF",
"Create0DElementsOnAllNodes","Reorient2D","QuadTo4Tri", "Create0DElementsOnAllNodes","Reorient2D","QuadTo4Tri",
"ScaleMakeGroups","Scale","ScaleMakeMesh", "ScaleMakeGroups","Scale","ScaleMakeMesh",
"FindCoincidentNodesOnPartBut","DoubleElements" "FindCoincidentNodesOnPartBut","DoubleElements",
"ExtrusionSweepObjects","RotationSweepObjects","ExtrusionAlongPathObjects"
,"" }; // <- mark of the end ,"" }; // <- mark of the end
methodsAcceptingList.Insert( methodNames ); methodsAcceptingList.Insert( methodNames );
} }
@ -2404,6 +2406,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
"ExtrusionSweep","AdvancedExtrusion","ExtrusionSweepObject","ExtrusionSweepObject1D", "ExtrusionSweep","AdvancedExtrusion","ExtrusionSweepObject","ExtrusionSweepObject1D",
"ExtrusionSweepObject2D","ExtrusionAlongPath","ExtrusionAlongPathObject", "ExtrusionSweepObject2D","ExtrusionAlongPath","ExtrusionAlongPathObject",
"ExtrusionAlongPathX","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D", "ExtrusionAlongPathX","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D",
"ExtrusionSweepObjects","RotationSweepObjects","ExtrusionAlongPathObjects",
"Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject", "Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject",
"FindCoincidentNodes","MergeNodes","FindEqualElements", "FindCoincidentNodes","MergeNodes","FindEqualElements",
"MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders", "MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders",

View File

@ -2413,6 +2413,7 @@ GetElementsId( SMESH_Mesh_ptr theMesh )
{ {
SMESH::long_array_var anArray = new SMESH::long_array; SMESH::long_array_var anArray = new SMESH::long_array;
if(!CORBA::is_nil(theMesh) && myPredicate){ if(!CORBA::is_nil(theMesh) && myPredicate){
theMesh->Load();
Controls::Filter::TIdSequence aSequence; Controls::Filter::TIdSequence aSequence;
GetElementsId(myPredicate,theMesh,aSequence); GetElementsId(myPredicate,theMesh,aSequence);
long i = 0, iEnd = aSequence.size(); long i = 0, iEnd = aSequence.size();

File diff suppressed because it is too large Load Diff

View File

@ -308,117 +308,59 @@ public:
void RenumberNodes() throw (SALOME::SALOME_Exception); void RenumberNodes() throw (SALOME::SALOME_Exception);
void RenumberElements() throw (SALOME::SALOME_Exception); void RenumberElements() throw (SALOME::SALOME_Exception);
void RotationSweep(const SMESH::long_array & IDsOfElements, SMESH::ListOfGroups* RotationSweepObjects(const SMESH::ListOfIDSources & nodes,
const SMESH::AxisStruct & Axis, const SMESH::ListOfIDSources & edges,
CORBA::Double AngleInRadians, const SMESH::ListOfIDSources & faces,
CORBA::Long NbOfSteps, const SMESH::AxisStruct & Axis,
CORBA::Double Tolerance) CORBA::Double AngleInRadians,
throw (SALOME::SALOME_Exception); CORBA::Long NbOfSteps,
void RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject, CORBA::Double Tolerance,
const SMESH::AxisStruct & Axis, CORBA::Boolean toMakeGroups)
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance)
throw (SALOME::SALOME_Exception);
void RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
const SMESH::AxisStruct & Axis,
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance)
throw (SALOME::SALOME_Exception);
void RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
const SMESH::AxisStruct & Axis,
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
void ExtrusionSweep(const SMESH::long_array & IDsOfElements, SMESH::ListOfGroups* ExtrusionSweepObjects(const SMESH::ListOfIDSources & nodes,
const SMESH::DirStruct & StepVector, const SMESH::ListOfIDSources & edges,
CORBA::Long NbOfSteps) const SMESH::ListOfIDSources & faces,
throw (SALOME::SALOME_Exception); const SMESH::DirStruct & stepVector,
void ExtrusionSweep0D(const SMESH::long_array & IDsOfElements, CORBA::Long nbOfSteps,
const SMESH::DirStruct & StepVector, CORBA::Boolean toMakeGroups)
CORBA::Long NbOfSteps)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject, SMESH::ListOfGroups* ExtrusionByNormal(const SMESH::ListOfIDSources& objects,
const SMESH::DirStruct & StepVector, CORBA::Double stepSize,
CORBA::Long NbOfSteps) CORBA::Long nbOfSteps,
CORBA::Boolean byAverageNormal,
CORBA::Boolean useInputElemsOnly,
CORBA::Boolean makeGroups,
CORBA::Short dim)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
const SMESH::DirStruct & theStepVector,
CORBA::Long theNbOfSteps,
CORBA::Long theExtrFlags,
CORBA::Double theSewTolerance,
CORBA::Boolean theMakeGroups)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
void ExtrusionSweepObject0D(SMESH::SMESH_IDSource_ptr theObject, SMESH::ListOfGroups*
const SMESH::DirStruct & StepVector, ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & nodes,
CORBA::Long NbOfSteps) const SMESH::ListOfIDSources & edges,
throw (SALOME::SALOME_Exception); const SMESH::ListOfIDSources & faces,
void ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject, SMESH::SMESH_IDSource_ptr PathMesh,
const SMESH::DirStruct & StepVector, GEOM::GEOM_Object_ptr PathShape,
CORBA::Long NbOfSteps) CORBA::Long NodeStart,
throw (SALOME::SALOME_Exception); CORBA::Boolean HasAngles,
void ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject, const SMESH::double_array & Angles,
const SMESH::DirStruct & StepVector, CORBA::Boolean LinearVariation,
CORBA::Long NbOfSteps) CORBA::Boolean HasRefPoint,
throw (SALOME::SALOME_Exception); const SMESH::PointStruct & RefPoint,
SMESH::ListOfGroups* ExtrusionByNormal(SMESH::SMESH_IDSource_ptr object, bool MakeGroups,
CORBA::Double stepSize, SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
CORBA::Long nbOfSteps,
CORBA::Boolean byAverageNormal,
CORBA::Boolean useInputElemsOnly,
CORBA::Boolean makeGroups,
CORBA::Short dim)
throw (SALOME::SALOME_Exception);
void AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
const SMESH::DirStruct & theStepVector,
CORBA::Long theNbOfSteps,
CORBA::Long theExtrFlags,
CORBA::Double theSewTolerance)
throw (SALOME::SALOME_Exception);
SMESH::SMESH_MeshEditor::Extrusion_Error
ExtrusionAlongPath(const SMESH::long_array & IDsOfElements,
SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array & Angles,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct & RefPoint)
throw (SALOME::SALOME_Exception);
SMESH::SMESH_MeshEditor::Extrusion_Error
ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array & Angles,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct & RefPoint)
throw (SALOME::SALOME_Exception);
SMESH::SMESH_MeshEditor::Extrusion_Error
ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr theObject,
SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array & Angles,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct & RefPoint)
throw (SALOME::SALOME_Exception);
SMESH::SMESH_MeshEditor::Extrusion_Error
ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr theObject,
SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array & Angles,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct & RefPoint)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh, SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape, GEOM::GEOM_Object_ptr PathShape,
const SMESH::double_array & Angles); const SMESH::double_array & Angles);
void Mirror(const SMESH::long_array & IDsOfElements, void Mirror(const SMESH::long_array & IDsOfElements,
const SMESH::AxisStruct & Axis, const SMESH::AxisStruct & Axis,
@ -449,128 +391,6 @@ public:
CORBA::Boolean Copy) CORBA::Boolean Copy)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* RotationSweepMakeGroups(const SMESH::long_array& IDsOfElements,
const SMESH::AxisStruct& Axix,
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
const SMESH::AxisStruct& Axix,
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
const SMESH::AxisStruct& Axix,
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
const SMESH::AxisStruct& Axix,
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
const SMESH::DirStruct& StepVector,
CORBA::Long NbOfSteps)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionSweepMakeGroups0D(const SMESH::long_array& IDsOfElements,
const SMESH::DirStruct& StepVector,
CORBA::Long NbOfSteps)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* AdvancedExtrusionMakeGroups(const SMESH::long_array& IDsOfElements,
const SMESH::DirStruct& StepVector,
CORBA::Long NbOfSteps,
CORBA::Long ExtrFlags,
CORBA::Double SewTolerance)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
const SMESH::DirStruct& StepVector,
CORBA::Long NbOfSteps)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionSweepObject0DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
const SMESH::DirStruct& StepVector,
CORBA::Long NbOfSteps)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
const SMESH::DirStruct& StepVector,
CORBA::Long NbOfSteps)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
const SMESH::DirStruct& StepVector,
CORBA::Long NbOfSteps)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionAlongPathMakeGroups(const SMESH::long_array& IDsOfElements,
SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array& Angles,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct& RefPoint,
SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr Object,
SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array& Angles,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct& RefPoint,
SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array& Angles,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct& RefPoint,
SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array& Angles,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct& RefPoint,
SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
throw (SALOME::SALOME_Exception);
// skl 04.06.2009
SMESH::ListOfGroups* ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object,
SMESH::SMESH_IDSource_ptr Path,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array& Angles,
CORBA::Boolean LinearVariation,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct& RefPoint,
CORBA::Boolean MakeGroups,
SMESH::ElementType ElemType,
SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionAlongPathX(const SMESH::long_array& IDsOfElements,
SMESH::SMESH_IDSource_ptr Path,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array& Angles,
CORBA::Boolean LinearVariation,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct& RefPoint,
CORBA::Boolean MakeGroups,
SMESH::ElementType ElemType,
SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements, SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
const SMESH::AxisStruct& Mirror, const SMESH::AxisStruct& Mirror,
SMESH::SMESH_MeshEditor::MirrorType MirrorType) SMESH::SMESH_MeshEditor::MirrorType MirrorType)
@ -1026,49 +846,6 @@ private: //!< private methods
SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs) SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs)
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* rotationSweep(const SMESH::long_array & IDsOfElements,
const SMESH::AxisStruct & Axis,
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance,
const bool MakeGroups,
const SMDSAbs_ElementType ElementType=SMDSAbs_All)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
MeshEditor_I::ExtrusionParams& params,
const SMDSAbs_ElementType ElementType=SMDSAbs_All)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* advancedExtrusion(const SMESH::long_array & theIDsOfElements,
const SMESH::DirStruct & theStepVector,
CORBA::Long theNbOfSteps,
CORBA::Long theExtrFlags,
CORBA::Double theSewTolerance,
const bool MakeGroups)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* extrusionAlongPath(const SMESH::long_array & IDsOfElements,
SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array & Angles,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct & RefPoint,
const bool MakeGroups,
SMESH::SMESH_MeshEditor::Extrusion_Error & Error,
const SMDSAbs_ElementType ElementType=SMDSAbs_All)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* extrusionAlongPathX(const SMESH::long_array & IDsOfElements,
SMESH::SMESH_IDSource_ptr Path,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array& Angles,
CORBA::Boolean LinearVariation,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct& RefPoint,
bool MakeGroups,
const SMDSAbs_ElementType ElementType,
SMESH::SMESH_MeshEditor::Extrusion_Error & theError)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* mirror(TIDSortedElemSet & IDsOfElements, SMESH::ListOfGroups* mirror(TIDSortedElemSet & IDsOfElements,
const SMESH::AxisStruct & Axis, const SMESH::AxisStruct & Axis,
SMESH::SMESH_MeshEditor::MirrorType MirrorType, SMESH::SMESH_MeshEditor::MirrorType MirrorType,
@ -1105,14 +882,25 @@ private: //!< private methods
SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName); SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
void dumpGroupsList(SMESH::TPythonDump & theDumpPython, void dumpGroupsList(SMESH::TPythonDump & theDumpPython,
const SMESH::ListOfGroups * theGroupList); const SMESH::ListOfGroups * theGroupList);
string generateGroupName(const string& thePrefix); string generateGroupName(const string& thePrefix);
void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject); void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject);
private: //!< fields
enum IDSource_Error { IDSource_OK, IDSource_INVALID, IDSource_EMPTY };
bool idSourceToSet(SMESH::SMESH_IDSource_ptr theIDSource,
const SMESHDS_Mesh* theMeshDS,
TIDSortedElemSet& theElemSet,
const SMDSAbs_ElementType theType,
const bool emptyIfIsMesh = false,
IDSource_Error* error = 0);
private: //!< fields
SMESH_Mesh_i* myMesh_i; SMESH_Mesh_i* myMesh_i;
SMESH_Mesh * myMesh; SMESH_Mesh * myMesh;

View File

@ -1077,14 +1077,35 @@ void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup
if ( _preMeshInfo ) if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile(); _preMeshInfo->FullLoadFromFile();
if ( theGroup->_is_nil() ) if ( theGroup->_is_nil() || theGroup->IsEmpty() )
return; return;
vector<int> nodeIds; // to remove nodes becoming free
CORBA::Long elemID = theGroup->GetID( 1 );
int nbElemNodes = GetElemNbNodes( elemID );
if ( nbElemNodes > 0 )
nodeIds.reserve( theGroup->Size() * nbElemNodes );
// Remove contents // Remove contents
SMESH::SMESH_IDSource_var idSrc = SMESH::SMESH_IDSource::_narrow( theGroup ); SMESH::SMESH_IDSource_var idSrc = SMESH::SMESH_IDSource::_narrow( theGroup );
SMDS_ElemIteratorPtr elemIt = GetElements( idSrc, theGroup->GetType() ); SMDS_ElemIteratorPtr elemIt = GetElements( idSrc, theGroup->GetType() );
while ( elemIt->more() ) while ( elemIt->more() )
{
const SMDS_MeshElement* e = elemIt->next();
SMDS_ElemIteratorPtr nIt = e->nodesIterator();
while ( nIt->more() )
nodeIds.push_back( nIt->next()->GetID() );
_impl->GetMeshDS()->RemoveElement( elemIt->next() ); _impl->GetMeshDS()->RemoveElement( elemIt->next() );
}
// Remove free nodes
if ( theGroup->GetType() != SMESH::NODE )
for ( size_t i = 0 ; i < nodeIds.size(); ++i )
if ( const SMDS_MeshNode* n = _impl->GetMeshDS()->FindNode( nodeIds[i] ))
if ( n->NbInverseElements() == 0 )
_impl->GetMeshDS()->RemoveFreeNode( n, /*sm=*/0 );
TPythonDump pyDump; // Supress dump from RemoveGroup() TPythonDump pyDump; // Supress dump from RemoveGroup()
@ -6022,6 +6043,8 @@ SMESH_MeshPartDS::SMESH_MeshPartDS(SMESH::SMESH_IDSource_ptr meshPart):
} }
myInfo = tmpInfo; myInfo = tmpInfo;
ShapeToMesh( _meshDS->ShapeToMesh() );
_meshDS = 0; // to enforce iteration on _elements and _nodes _meshDS = 0; // to enforce iteration on _elements and _nodes
} }
} }

View File

@ -161,6 +161,9 @@ SMESH.PointStruct.__init__ = __initPointStruct
# Substitute AxisStruct.__init__() to create SMESH.AxisStruct using notebook variables. # Substitute AxisStruct.__init__() to create SMESH.AxisStruct using notebook variables.
# Parameters are stored in AxisStruct.parameters attribute # Parameters are stored in AxisStruct.parameters attribute
def __initAxisStruct(ax,*args): def __initAxisStruct(ax,*args):
if len( args ) != 6:
raise RuntimeError,\
"Bad nb args (%s) passed in SMESH.AxisStruct(x,y,z,dx,dy,dz)"%(len( args ))
ax.x, ax.y, ax.z, ax.vx, ax.vy, ax.vz, ax.parameters,hasVars = ParseParameters(*args) ax.x, ax.y, ax.z, ax.vx, ax.vy, ax.vz, ax.parameters,hasVars = ParseParameters(*args)
pass pass
SMESH.AxisStruct.__init__ = __initAxisStruct SMESH.AxisStruct.__init__ = __initAxisStruct
@ -3515,6 +3518,56 @@ class Mesh:
def RenumberElements(self): def RenumberElements(self):
self.editor.RenumberElements() self.editor.RenumberElements()
## Private method converting \a arg into a list of SMESH_IdSource's
def _getIdSourceList(self, arg, idType, unRegister):
if arg and isinstance( arg, list ):
if isinstance( arg[0], int ):
arg = self.GetIDSource( arg, idType )
unRegister.set( arg )
elif isinstance( arg[0], Mesh ):
arg[0] = arg[0].GetMesh()
elif isinstance( arg, Mesh ):
arg = arg.GetMesh()
if arg and isinstance( arg, SMESH._objref_SMESH_IDSource ):
arg = [arg]
return arg
## Generates new elements by rotation of the given elements and nodes around the axis
# @param nodes - nodes to revolve: a list including ids, groups, sub-meshes or a mesh
# @param edges - edges to revolve: a list including ids, groups, sub-meshes or a mesh
# @param faces - faces to revolve: a list including ids, groups, sub-meshes or a mesh
# @param Axis the axis of rotation: AxisStruct, line (geom object) or [x,y,z,dx,dy,dz]
# @param AngleInRadians the angle of Rotation (in radians) or a name of variable
# which defines angle in degrees
# @param NbOfSteps the number of steps
# @param Tolerance tolerance
# @param MakeGroups forces the generation of new groups from existing ones
# @param TotalAngle gives meaning of AngleInRadians: if True then it is an angular size
# of all steps, else - size of each step
# @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
# @ingroup l2_modif_extrurev
def RotationSweepObjects(self, nodes, edges, faces, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False):
unRegister = genObjUnRegister()
nodes = self._getIdSourceList( nodes, SMESH.NODE, unRegister )
edges = self._getIdSourceList( edges, SMESH.EDGE, unRegister )
faces = self._getIdSourceList( faces, SMESH.FACE, unRegister )
if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
Axis = self.smeshpyD.GetDirStruct( Axis )
if isinstance( Axis, list ):
Axis = SMESH.AxisStruct( *Axis )
AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
Parameters = Axis.parameters + var_separator + AngleParameters + var_separator + Parameters
self.mesh.SetParameters(Parameters)
if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps
return self.editor.RotationSweepObjects( nodes, edges, faces,
Axis, AngleInRadians,
NbOfSteps, Tolerance, MakeGroups)
## Generates new elements by rotation of the elements around the axis ## Generates new elements by rotation of the elements around the axis
# @param IDsOfElements the list of ids of elements to sweep # @param IDsOfElements the list of ids of elements to sweep
# @param Axis the axis of rotation, AxisStruct or line(geom object) # @param Axis the axis of rotation, AxisStruct or line(geom object)
@ -3528,9 +3581,15 @@ class Mesh:
# @ingroup l2_modif_extrurev # @ingroup l2_modif_extrurev
def RotationSweep(self, IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance, def RotationSweep(self, IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False): MakeGroups=False, TotalAngle=False):
unRegister = genObjUnRegister()
if IDsOfElements == []: if IDsOfElements == []:
IDsOfElements = self.GetElementsId() IDsOfElements = self.mesh
if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)): if IDsOfElements and \
isinstance( IDsOfElements, list ) and \
isinstance( IDsOfElements[0], int ):
IDsOfElements = self.GetIDSource( IDsOfElements, SMESH.ALL )
unRegister.set( IDsOfElements )
if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
Axis = self.smeshpyD.GetAxisStruct(Axis) Axis = self.smeshpyD.GetAxisStruct(Axis)
AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians) AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance) NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
@ -3538,11 +3597,8 @@ class Mesh:
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if TotalAngle and NbOfSteps: if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps AngleInRadians /= NbOfSteps
if MakeGroups: return self.editor.RotationSweepObjects([],[IDsOfElements],[IDsOfElements], Axis,
return self.editor.RotationSweepMakeGroups(IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance, MakeGroups)
AngleInRadians, NbOfSteps, Tolerance)
self.editor.RotationSweep(IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance)
return []
## Generates new elements by rotation of the elements of object around the axis ## Generates new elements by rotation of the elements of object around the axis
# @param theObject object which elements should be sweeped. # @param theObject object which elements should be sweeped.
@ -3558,9 +3614,9 @@ class Mesh:
# @ingroup l2_modif_extrurev # @ingroup l2_modif_extrurev
def RotationSweepObject(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance, def RotationSweepObject(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False): MakeGroups=False, TotalAngle=False):
if ( isinstance( theObject, Mesh )): if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)): if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
Axis = self.smeshpyD.GetAxisStruct(Axis) Axis = self.smeshpyD.GetAxisStruct(Axis)
AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians) AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance) NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
@ -3568,11 +3624,8 @@ class Mesh:
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if TotalAngle and NbOfSteps: if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps AngleInRadians /= NbOfSteps
if MakeGroups: return self.editor.RotationSweepObjects([],[theObject],[theObject], Axis,
return self.editor.RotationSweepObjectMakeGroups(theObject, Axis, AngleInRadians, AngleInRadians, NbOfSteps, Tolerance )
NbOfSteps, Tolerance)
self.editor.RotationSweepObject(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance)
return []
## Generates new elements by rotation of the elements of object around the axis ## Generates new elements by rotation of the elements of object around the axis
# @param theObject object which elements should be sweeped. # @param theObject object which elements should be sweeped.
@ -3588,9 +3641,9 @@ class Mesh:
# @ingroup l2_modif_extrurev # @ingroup l2_modif_extrurev
def RotationSweepObject1D(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance, def RotationSweepObject1D(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False): MakeGroups=False, TotalAngle=False):
if ( isinstance( theObject, Mesh )): if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)): if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
Axis = self.smeshpyD.GetAxisStruct(Axis) Axis = self.smeshpyD.GetAxisStruct(Axis)
AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians) AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance) NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
@ -3598,11 +3651,8 @@ class Mesh:
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if TotalAngle and NbOfSteps: if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps AngleInRadians /= NbOfSteps
if MakeGroups: return self.editor.RotationSweepObjects([],[theObject],[], Axis,
return self.editor.RotationSweepObject1DMakeGroups(theObject, Axis, AngleInRadians, AngleInRadians, NbOfSteps, Tolerance)
NbOfSteps, Tolerance)
self.editor.RotationSweepObject1D(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance)
return []
## Generates new elements by rotation of the elements of object around the axis ## Generates new elements by rotation of the elements of object around the axis
# @param theObject object which elements should be sweeped. # @param theObject object which elements should be sweeped.
@ -3618,9 +3668,9 @@ class Mesh:
# @ingroup l2_modif_extrurev # @ingroup l2_modif_extrurev
def RotationSweepObject2D(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance, def RotationSweepObject2D(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False): MakeGroups=False, TotalAngle=False):
if ( isinstance( theObject, Mesh )): if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)): if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
Axis = self.smeshpyD.GetAxisStruct(Axis) Axis = self.smeshpyD.GetAxisStruct(Axis)
AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians) AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance) NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
@ -3628,11 +3678,37 @@ class Mesh:
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if TotalAngle and NbOfSteps: if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps AngleInRadians /= NbOfSteps
if MakeGroups: return self.editor.RotationSweepObjects([],[],[theObject], Axis, AngleInRadians,
return self.editor.RotationSweepObject2DMakeGroups(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance)
NbOfSteps, Tolerance)
self.editor.RotationSweepObject2D(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance) ## Generates new elements by extrusion of the given elements and nodes
return [] # @param nodes - nodes to extrude: a list including ids, groups, sub-meshes or a mesh
# @param edges - edges to extrude: a list including ids, groups, sub-meshes or a mesh
# @param faces - faces to extrude: a list including ids, groups, sub-meshes or a mesh
# @param StepVector vector or DirStruct or 3 vector components, defining
# the direction and value of extrusion for one step (the total extrusion
# length will be NbOfSteps * ||StepVector||)
# @param NbOfSteps the number of steps
# @param MakeGroups forces the generation of new groups from existing ones
# @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
# @ingroup l2_modif_extrurev
def ExtrusionSweepObjects(self, nodes, edges, faces, StepVector, NbOfSteps, MakeGroups=False):
unRegister = genObjUnRegister()
nodes = self._getIdSourceList( nodes, SMESH.NODE, unRegister )
edges = self._getIdSourceList( edges, SMESH.EDGE, unRegister )
faces = self._getIdSourceList( faces, SMESH.FACE, unRegister )
if isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object):
StepVector = self.smeshpyD.GetDirStruct(StepVector)
if isinstance( StepVector, list ):
StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
Parameters = StepVector.PS.parameters + var_separator + Parameters
self.mesh.SetParameters(Parameters)
return self.editor.ExtrusionSweepObjects( nodes, edges, faces, StepVector, NbOfSteps, MakeGroups)
## Generates new elements by extrusion of the elements with given ids ## Generates new elements by extrusion of the elements with given ids
# @param IDsOfElements the list of elements ids for extrusion # @param IDsOfElements the list of elements ids for extrusion
@ -3646,7 +3722,13 @@ class Mesh:
# @ingroup l2_modif_extrurev # @ingroup l2_modif_extrurev
def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False, IsNodes = False): def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False, IsNodes = False):
if IDsOfElements == []: if IDsOfElements == []:
IDsOfElements = self.GetElementsId() IDsOfElements = self.mesh
unRegister = genObjUnRegister()
if IDsOfElements and \
isinstance( IDsOfElements, list ) and \
isinstance( IDsOfElements[0], int ):
IDsOfElements = self.GetIDSource( IDsOfElements, SMESH.ALL )
unRegister.set( IDsOfElements )
if isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object): if isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object):
StepVector = self.smeshpyD.GetDirStruct(StepVector) StepVector = self.smeshpyD.GetDirStruct(StepVector)
if isinstance( StepVector, list ): if isinstance( StepVector, list ):
@ -3654,46 +3736,14 @@ class Mesh:
NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps) NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
Parameters = StepVector.PS.parameters + var_separator + Parameters Parameters = StepVector.PS.parameters + var_separator + Parameters
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if MakeGroups: n,e,f = [],[],[]
if(IsNodes): if IsNodes: n = [IDsOfElements]
return self.editor.ExtrusionSweepMakeGroups0D(IDsOfElements, StepVector, NbOfSteps) else : e,f, = [IDsOfElements],[IDsOfElements]
else: return self.editor.ExtrusionSweepObjects(n,e,f, StepVector, NbOfSteps, MakeGroups)
return self.editor.ExtrusionSweepMakeGroups(IDsOfElements, StepVector, NbOfSteps)
if(IsNodes):
self.editor.ExtrusionSweep0D(IDsOfElements, StepVector, NbOfSteps)
else:
self.editor.ExtrusionSweep(IDsOfElements, StepVector, NbOfSteps)
return []
## Generates new elements by extrusion of the elements with given ids
# @param IDsOfElements is ids of elements
# @param StepVector vector or DirStruct or 3 vector components, defining
# the direction and value of extrusion for one step (the total extrusion
# length will be NbOfSteps * ||StepVector||)
# @param NbOfSteps the number of steps
# @param ExtrFlags sets flags for extrusion
# @param SewTolerance uses for comparing locations of nodes if flag
# EXTRUSION_FLAG_SEW is set
# @param MakeGroups forces the generation of new groups from existing ones
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
# @ingroup l2_modif_extrurev
def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps,
ExtrFlags, SewTolerance, MakeGroups=False):
if ( isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object)):
StepVector = self.smeshpyD.GetDirStruct(StepVector)
if isinstance( StepVector, list ):
StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
if MakeGroups:
return self.editor.AdvancedExtrusionMakeGroups(IDsOfElements, StepVector, NbOfSteps,
ExtrFlags, SewTolerance)
self.editor.AdvancedExtrusion(IDsOfElements, StepVector, NbOfSteps,
ExtrFlags, SewTolerance)
return []
## Generates new elements by extrusion along the normal to a discretized surface or wire ## Generates new elements by extrusion along the normal to a discretized surface or wire
# @param Elements container of elements to extrude; # @param Elements elements to extrude - a list including ids, groups, sub-meshes or a mesh
# it can be Mesh, Group, Sub-mesh, Filter or list of IDs; # Only faces can be extruded so far. Sub-mesh should be a sub-mesh on geom faces.
# Only faces can be extruded so far. Sub-mesh sould be a sub-mesh on geom faces.
# @param StepSize length of one extrusion step (the total extrusion # @param StepSize length of one extrusion step (the total extrusion
# length will be \a NbOfSteps * \a StepSize ). # length will be \a NbOfSteps * \a StepSize ).
# @param NbOfSteps number of extrusion steps. # @param NbOfSteps number of extrusion steps.
@ -3715,14 +3765,15 @@ class Mesh:
ByAverageNormal=False, UseInputElemsOnly=True, MakeGroups=False, Dim = 2): ByAverageNormal=False, UseInputElemsOnly=True, MakeGroups=False, Dim = 2):
unRegister = genObjUnRegister() unRegister = genObjUnRegister()
if isinstance( Elements, Mesh ): if isinstance( Elements, Mesh ):
Elements = Elements.GetMesh() Elements = [ Elements.GetMesh() ]
if isinstance( Elements, list ): if isinstance( Elements, list ):
if not Elements: if not Elements:
raise RuntimeError, "List of element IDs is empty!" raise RuntimeError, "Elements empty!"
if not isinstance( Elements[0], int ): if isinstance( Elements[0], int ):
raise RuntimeError, "List must contain element IDs and not %s"% Elements[0] Elements = self.GetIDSource( Elements, SMESH.ALL )
Elements = self.GetIDSource( Elements, SMESH.ALL ) unRegister.set( Elements )
unRegister.set( Elements ) else:
Elements = [ Elements ]
StepSize,NbOfSteps,Parameters,hasVars = ParseParameters(StepSize,NbOfSteps) StepSize,NbOfSteps,Parameters,hasVars = ParseParameters(StepSize,NbOfSteps)
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
return self.editor.ExtrusionByNormal(Elements, StepSize, NbOfSteps, return self.editor.ExtrusionByNormal(Elements, StepSize, NbOfSteps,
@ -3736,29 +3787,23 @@ class Mesh:
# length will be NbOfSteps * ||StepVector||) # length will be NbOfSteps * ||StepVector||)
# @param NbOfSteps the number of steps # @param NbOfSteps the number of steps
# @param MakeGroups forces the generation of new groups from existing ones # @param MakeGroups forces the generation of new groups from existing ones
# @param IsNodes is True if elements which belong to the object are nodes # @param IsNodes is True if elements to extrude are nodes
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
# @ingroup l2_modif_extrurev # @ingroup l2_modif_extrurev
def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False, IsNodes=False): def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False, IsNodes=False):
if ( isinstance( theObject, Mesh )): if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
if ( isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object)): if isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object):
StepVector = self.smeshpyD.GetDirStruct(StepVector) StepVector = self.smeshpyD.GetDirStruct(StepVector)
if isinstance( StepVector, list ): if isinstance( StepVector, list ):
StepVector = self.smeshpyD.MakeDirStruct(*StepVector) StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps) NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
Parameters = StepVector.PS.parameters + var_separator + Parameters Parameters = StepVector.PS.parameters + var_separator + Parameters
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if MakeGroups: n,e,f = [],[],[]
if(IsNodes): if IsNodes: n = [theObject]
return self.editor.ExtrusionSweepObject0DMakeGroups(theObject, StepVector, NbOfSteps) else : e,f, = [theObject],[theObject]
else: return self.editor.ExtrusionSweepObjects(n,e,f, StepVector, NbOfSteps, MakeGroups)
return self.editor.ExtrusionSweepObjectMakeGroups(theObject, StepVector, NbOfSteps)
if(IsNodes):
self.editor.ExtrusionSweepObject0D(theObject, StepVector, NbOfSteps)
else:
self.editor.ExtrusionSweepObject(theObject, StepVector, NbOfSteps)
return []
## Generates new elements by extrusion of the elements which belong to the object ## Generates new elements by extrusion of the elements which belong to the object
# @param theObject object which elements should be processed. # @param theObject object which elements should be processed.
@ -3780,10 +3825,8 @@ class Mesh:
NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps) NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
Parameters = StepVector.PS.parameters + var_separator + Parameters Parameters = StepVector.PS.parameters + var_separator + Parameters
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if MakeGroups: return self.editor.ExtrusionSweepObjects([],[theObject],[],
return self.editor.ExtrusionSweepObject1DMakeGroups(theObject, StepVector, NbOfSteps) StepVector, NbOfSteps, MakeGroups)
self.editor.ExtrusionSweepObject1D(theObject, StepVector, NbOfSteps)
return []
## Generates new elements by extrusion of the elements which belong to the object ## Generates new elements by extrusion of the elements which belong to the object
# @param theObject object which elements should be processed. # @param theObject object which elements should be processed.
@ -3805,12 +3848,72 @@ class Mesh:
NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps) NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
Parameters = StepVector.PS.parameters + var_separator + Parameters Parameters = StepVector.PS.parameters + var_separator + Parameters
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if MakeGroups: return self.editor.ExtrusionSweepObjects([],[],[theObject],
return self.editor.ExtrusionSweepObject2DMakeGroups(theObject, StepVector, NbOfSteps) StepVector, NbOfSteps, MakeGroups)
self.editor.ExtrusionSweepObject2D(theObject, StepVector, NbOfSteps)
return []
## Generates new elements by extrusion of the elements with given ids
# @param IDsOfElements is ids of elements
# @param StepVector vector or DirStruct or 3 vector components, defining
# the direction and value of extrusion for one step (the total extrusion
# length will be NbOfSteps * ||StepVector||)
# @param NbOfSteps the number of steps
# @param ExtrFlags sets flags for extrusion
# @param SewTolerance uses for comparing locations of nodes if flag
# EXTRUSION_FLAG_SEW is set
# @param MakeGroups forces the generation of new groups from existing ones
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
# @ingroup l2_modif_extrurev
def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps,
ExtrFlags, SewTolerance, MakeGroups=False):
if isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object):
StepVector = self.smeshpyD.GetDirStruct(StepVector)
if isinstance( StepVector, list ):
StepVector = self.smeshpyD.MakeDirStruct(*StepVector)
return self.editor.AdvancedExtrusion(IDsOfElements, StepVector, NbOfSteps,
ExtrFlags, SewTolerance, MakeGroups)
## Generates new elements by extrusion of the given elements and nodes along the path.
# The path of extrusion must be a meshed edge.
# @param Nodes nodes to extrude: a list including ids, groups, sub-meshes or a mesh
# @param Edges edges to extrude: a list including ids, groups, sub-meshes or a mesh
# @param Faces faces to extrude: a list including ids, groups, sub-meshes or a mesh
# @param PathMesh 1D mesh or 1D sub-mesh, along which proceeds the extrusion
# @param PathShape shape (edge) defines the sub-mesh of PathMesh if PathMesh
# contains not only path segments, else it can be None
# @param NodeStart the first or the last node on the path. Defines the direction of extrusion
# @param HasAngles allows the shape to be rotated around the path
# to get the resulting mesh in a helical fashion
# @param Angles list of angles
# @param HasRefPoint allows using the reference point
# @param RefPoint the point around which the shape is rotated (the mass center of the
# shape by default). The User can specify any point as the Reference Point.
# @param MakeGroups forces the generation of new groups from existing ones
# @param LinearVariation forces the computation of rotation angles as linear
# variation of the given Angles along path steps
# @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error
# @ingroup l2_modif_extrurev
def ExtrusionAlongPathObjects(self, Nodes, Edges, Faces, PathMesh, PathShape=None,
NodeStart=1, HasAngles=False, Angles=[],
HasRefPoint=False, RefPoint=[0,0,0],
MakeGroups=False, LinearVariation=False):
unRegister = genObjUnRegister()
Nodes = self._getIdSourceList( Nodes, SMESH.NODE, unRegister )
Edges = self._getIdSourceList( Edges, SMESH.EDGE, unRegister )
Faces = self._getIdSourceList( Faces, SMESH.FACE, unRegister )
if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
if isinstance( RefPoint, list ):
RefPoint = SMESH.PointStruct( *RefPoint )
if isinstance( PathMesh, Mesh ):
PathMesh = PathMesh.GetMesh()
Angles,AnglesParameters,hasVars = ParseAngles(Angles)
Parameters = AnglesParameters + var_separator + RefPoint.parameters
self.mesh.SetParameters(Parameters)
return self.editor.ExtrusionAlongPathObjects(Nodes, Edges, Faces,
PathMesh, PathShape, NodeStart,
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups)
## Generates new elements by extrusion of the given elements ## Generates new elements by extrusion of the given elements
# The path of extrusion must be a meshed edge. # The path of extrusion must be a meshed edge.
@ -3845,23 +3948,30 @@ class Mesh:
Parameters = AnglesParameters + var_separator + RefPoint.parameters Parameters = AnglesParameters + var_separator + RefPoint.parameters
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if (isinstance(Path, Mesh)): Path = Path.GetMesh() if isinstance(Path, Mesh): Path = Path.GetMesh()
unRegister = genObjUnRegister()
if isinstance(Base, list): if isinstance(Base, list):
IDsOfElements = [] if Base:
if Base == []: IDsOfElements = self.GetElementsId() Base = self.GetIDSource( Base, ElemType )
else: IDsOfElements = Base unRegister.set( Base )
return self.editor.ExtrusionAlongPathX(IDsOfElements, Path, NodeStart,
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups, ElemType)
else:
if isinstance(Base, Mesh): Base = Base.GetMesh()
if isinstance(Base, SMESH._objref_SMESH_Mesh) or isinstance(Base, SMESH._objref_SMESH_Group) or isinstance(Base, SMESH._objref_SMESH_subMesh):
return self.editor.ExtrusionAlongPathObjX(Base, Path, NodeStart,
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups, ElemType)
else: else:
raise RuntimeError, "Invalid Base for ExtrusionAlongPathX" Base = self.mesh
else:
if isinstance(Base, Mesh):
Base = Base.GetMesh()
if isinstance(Base, SMESH._objref_SMESH_IDSource):
n,e,f = [],[],[]
if ElemType == SMESH.NODE: n = [Base]
if ElemType == SMESH.EDGE: e = [Base]
if ElemType == SMESH.FACE: f = [Base]
gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, Path, None, NodeStart,
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups)
if MakeGroups: return gr,er
return er
else:
raise RuntimeError, "Invalid Base for ExtrusionAlongPathX"
## Generates new elements by extrusion of the given elements ## Generates new elements by extrusion of the given elements
@ -3887,28 +3997,26 @@ class Mesh:
MakeGroups=False, LinearVariation=False): MakeGroups=False, LinearVariation=False):
if IDsOfElements == []: if IDsOfElements == []:
IDsOfElements = self.GetElementsId() IDsOfElements = self.GetElementsId()
if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)): if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
RefPoint = self.smeshpyD.GetPointStruct(RefPoint) RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
pass pass
if ( isinstance( PathMesh, Mesh )): if isinstance( PathMesh, Mesh ):
PathMesh = PathMesh.GetMesh() PathMesh = PathMesh.GetMesh()
Angles,AnglesParameters,hasVars = ParseAngles(Angles) Angles,AnglesParameters,hasVars = ParseAngles(Angles)
Parameters = AnglesParameters + var_separator + RefPoint.parameters Parameters = AnglesParameters + var_separator + RefPoint.parameters
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if HasAngles and Angles and LinearVariation: n,e,f = [],[IDsOfElements],[IDsOfElements]
Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles ) gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape,
pass NodeStart, HasAngles, Angles,
if MakeGroups: LinearVariation,
return self.editor.ExtrusionAlongPathMakeGroups(IDsOfElements, PathMesh, HasRefPoint, RefPoint, MakeGroups)
PathShape, NodeStart, HasAngles, if MakeGroups: return gr,er
Angles, HasRefPoint, RefPoint) return er
return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh, PathShape,
NodeStart, HasAngles, Angles, HasRefPoint, RefPoint)
## Generates new elements by extrusion of the elements which belong to the object ## Generates new elements by extrusion of the elements which belong to the object
# The path of extrusion must be a meshed edge. # The path of extrusion must be a meshed edge.
# @param theObject the object which elements should be processed. # @param theObject the object which elements should be processed.
# It can be a mesh, a sub mesh or a group. # It can be a mesh, a sub-mesh or a group.
# @param PathMesh mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds # @param PathMesh mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
# @param PathShape shape(edge) defines the sub-mesh for the path # @param PathShape shape(edge) defines the sub-mesh for the path
# @param NodeStart the first or the last node on the edge. Defines the direction of extrusion # @param NodeStart the first or the last node on the edge. Defines the direction of extrusion
@ -3927,25 +4035,21 @@ class Mesh:
def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart, def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint, HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False): MakeGroups=False, LinearVariation=False):
if ( isinstance( theObject, Mesh )): if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)): if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
RefPoint = self.smeshpyD.GetPointStruct(RefPoint) RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
if ( isinstance( PathMesh, Mesh )): if isinstance( PathMesh, Mesh ):
PathMesh = PathMesh.GetMesh() PathMesh = PathMesh.GetMesh()
Angles,AnglesParameters,hasVars = ParseAngles(Angles) Angles,AnglesParameters,hasVars = ParseAngles(Angles)
Parameters = AnglesParameters + var_separator + RefPoint.parameters Parameters = AnglesParameters + var_separator + RefPoint.parameters
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if HasAngles and Angles and LinearVariation: n,e,f = [],[theObject],[theObject]
Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles ) gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
pass HasAngles, Angles, LinearVariation,
if MakeGroups: HasRefPoint, RefPoint, MakeGroups)
return self.editor.ExtrusionAlongPathObjectMakeGroups(theObject, PathMesh, if MakeGroups: return gr,er
PathShape, NodeStart, HasAngles, return er
Angles, HasRefPoint, RefPoint)
return self.editor.ExtrusionAlongPathObject(theObject, PathMesh, PathShape,
NodeStart, HasAngles, Angles, HasRefPoint,
RefPoint)
## Generates new elements by extrusion of the elements which belong to the object ## Generates new elements by extrusion of the elements which belong to the object
# The path of extrusion must be a meshed edge. # The path of extrusion must be a meshed edge.
@ -3969,25 +4073,21 @@ class Mesh:
def ExtrusionAlongPathObject1D(self, theObject, PathMesh, PathShape, NodeStart, def ExtrusionAlongPathObject1D(self, theObject, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint, HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False): MakeGroups=False, LinearVariation=False):
if ( isinstance( theObject, Mesh )): if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)): if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
RefPoint = self.smeshpyD.GetPointStruct(RefPoint) RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
if ( isinstance( PathMesh, Mesh )): if isinstance( PathMesh, Mesh ):
PathMesh = PathMesh.GetMesh() PathMesh = PathMesh.GetMesh()
Angles,AnglesParameters,hasVars = ParseAngles(Angles) Angles,AnglesParameters,hasVars = ParseAngles(Angles)
Parameters = AnglesParameters + var_separator + RefPoint.parameters Parameters = AnglesParameters + var_separator + RefPoint.parameters
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if HasAngles and Angles and LinearVariation: n,e,f = [],[theObject],[]
Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles ) gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
pass HasAngles, Angles, LinearVariation,
if MakeGroups: HasRefPoint, RefPoint, MakeGroups)
return self.editor.ExtrusionAlongPathObject1DMakeGroups(theObject, PathMesh, if MakeGroups: return gr,er
PathShape, NodeStart, HasAngles, return er
Angles, HasRefPoint, RefPoint)
return self.editor.ExtrusionAlongPathObject1D(theObject, PathMesh, PathShape,
NodeStart, HasAngles, Angles, HasRefPoint,
RefPoint)
## Generates new elements by extrusion of the elements which belong to the object ## Generates new elements by extrusion of the elements which belong to the object
# The path of extrusion must be a meshed edge. # The path of extrusion must be a meshed edge.
@ -4020,16 +4120,12 @@ class Mesh:
Angles,AnglesParameters,hasVars = ParseAngles(Angles) Angles,AnglesParameters,hasVars = ParseAngles(Angles)
Parameters = AnglesParameters + var_separator + RefPoint.parameters Parameters = AnglesParameters + var_separator + RefPoint.parameters
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
if HasAngles and Angles and LinearVariation: n,e,f = [],[],[theObject]
Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles ) gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
pass HasAngles, Angles, LinearVariation,
if MakeGroups: HasRefPoint, RefPoint, MakeGroups)
return self.editor.ExtrusionAlongPathObject2DMakeGroups(theObject, PathMesh, if MakeGroups: return gr,er
PathShape, NodeStart, HasAngles, return er
Angles, HasRefPoint, RefPoint)
return self.editor.ExtrusionAlongPathObject2D(theObject, PathMesh, PathShape,
NodeStart, HasAngles, Angles, HasRefPoint,
RefPoint)
## Creates a symmetrical copy of mesh elements ## Creates a symmetrical copy of mesh elements
# @param IDsOfElements list of elements ids # @param IDsOfElements list of elements ids
@ -4360,7 +4456,9 @@ class Mesh:
return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,exceptNodes) return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,exceptNodes)
## Merges nodes ## Merges nodes
# @param GroupsOfNodes a list of pairs of nodes IDs for merging (e.g. [[1,12],[25,4]]) # @param GroupsOfNodes a list of pairs of nodes IDs for merging
# (e.g. [[1,12],[25,4]], then nodes 12 and 4 will be removed and replaced
# by nodes 1 and 25 correspondingly in all elements and groups
# @ingroup l2_modif_trsf # @ingroup l2_modif_trsf
def MergeNodes (self, GroupsOfNodes): def MergeNodes (self, GroupsOfNodes):
self.editor.MergeNodes(GroupsOfNodes) self.editor.MergeNodes(GroupsOfNodes)
@ -4369,13 +4467,17 @@ class Mesh:
# @param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching # @param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching
# @return the list of pairs of equal elements IDs (e.g. [[1,12],[25,4]]) # @return the list of pairs of equal elements IDs (e.g. [[1,12],[25,4]])
# @ingroup l2_modif_trsf # @ingroup l2_modif_trsf
def FindEqualElements (self, MeshOrSubMeshOrGroup): def FindEqualElements (self, MeshOrSubMeshOrGroup=None):
if ( isinstance( MeshOrSubMeshOrGroup, Mesh )): if not MeshOrSubMeshOrGroup:
MeshOrSubMeshOrGroup=self.mesh
elif isinstance( MeshOrSubMeshOrGroup, Mesh ):
MeshOrSubMeshOrGroup = MeshOrSubMeshOrGroup.GetMesh() MeshOrSubMeshOrGroup = MeshOrSubMeshOrGroup.GetMesh()
return self.editor.FindEqualElements(MeshOrSubMeshOrGroup) return self.editor.FindEqualElements( MeshOrSubMeshOrGroup )
## Merges elements in each given group. ## Merges elements in each given group.
# @param GroupsOfElementsID a list of pairs of elements IDs for merging (e.g. [[1,12],[25,4]]) # @param GroupsOfElementsID a list of pairs of elements IDs for merging
# (e.g. [[1,12],[25,4]], then elements 12 and 4 will be removed and
# replaced by elements 1 and 25 in all groups)
# @ingroup l2_modif_trsf # @ingroup l2_modif_trsf
def MergeElements(self, GroupsOfElementsID): def MergeElements(self, GroupsOfElementsID):
self.editor.MergeElements(GroupsOfElementsID) self.editor.MergeElements(GroupsOfElementsID)