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
\n Extrusion is used to build mesh elements of plus one
dimension than the input ones. Boundary elements around elements of
plus one dimension are additionally created. All created elements
can be automatically grouped. Extrusion can be used to create a
\ref extrusion_struct "structured mesh from scratch".
dimension than the input ones. Boundary elements around generated
mesh of plus one dimension are additionally created. All created
elements can be automatically grouped. Extrusion can be used to create
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
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>
</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
@ -44,65 +45,72 @@ The following dialog common for node, segments and faces will appear:
<li>In this dialog:
<ul>
<li>Select the type of elements which will be extruded (nodes, 1D or
2D elements).</li>
<li>Specify the IDs of the elements which will be extruded by one
following means:
<li>Specify \b Nodes, \b Edges and \b Faces, which will be extruded, 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>ID Elements</b>
field. The selected elements will be highlighted in the viewer.</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>If the <b>Extrusion to Distance</b> radio button is selected</li>
<ul>
<li>specify the translation vector by which the elements will be extruded.</li>
</ul>
<li>If the <b>Extrusion Along Vector</b> radio button is selected</li>
<ul>
<li>specify the coordinates of the \b Vector along which the elements
will be extruded, or select the face (the normal to the face will
define the vector),</li>
<li>specify the \b Distance of extrusion along the vector (it can
be negative).</li>
</ul>
<li>If the <b>Extrusion to Distance</b> radio button is selected
- specify the translation vector by which the elements will be extruded.
</li>
<li>If the <b>Extrusion Along Vector</b> radio button is selected
<ul>
<li>specify the coordinates of the \b Vector along which the elements
will be extruded, either directly or by selecting the mesh face (the
normal to the face will define the vector),</li>
<li>specify the \b Distance of extrusion along the vector (it can
be negative).</li>
</ul>
</li>
<li>If the <b>Extrusion By Normal</b> radio button is selected,
which is visible in \b 2D mode only, every node of selected
elements is extruded along the \a average of the \a normal vectors to
the faces sharing the node.</li>
<ul>
<li>Specify the \b Distance of extrusion (it can be negative),</li>
<li>Use <b>Along average normal</b> check-box to specify along
what vector the distance is measured. If it is \a activated the
distance is measured along the average normal mentioned
above. If it is \a deactivated every node is extruded along the
average normal till its intersection with the virtual plane got
by translation of the face sharing the node along its own normal
by the distance. <br>
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).
every node of selected faces is extruded along the \a average
of the \a normal vectors to the faces sharing the node. (Nodes and
edges can't be extruded in this mode.)
<ul>
<li>Specify the \b Distance of extrusion (it can be negative),</li>
<li>Use <b>Along average normal</b> check-box to specify along
what vector the distance is measured.
<ul>
<li>If it is \a activated the distance is measured along the
average normal mentioned above. </li>
<li>If it is \a deactivated every node is extruded along the
average normal till its intersection with the virtual plane got
by translation of the face sharing the node along its own normal
by the \b Distance.</li>
</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
<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_alongavgnorm.png "'Along average normal' activated (to the left) and deactivated (to the right)"
<p></li>
\image html extrusionbynormal_useonly.png
<p></li>
<li>Using <b>Use only input elements</b> check-box specify what
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>
<li>Specify the <b>Number of steps</b>.</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
@ -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>
</ol>
<p>
\anchor extrusion_struct
<h2>Example: creation of a structured mesh from scratch</h2>

View File

@ -3,7 +3,7 @@
\page extrusion_along_path_page Extrusion along Path
\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.
To get an idea of how this algorithm works, examine several examples,
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
<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
</li>
<li>In this dialog:
<ul>
<li>select the type of elements which will be extruded (1D or 2D),</li>
<li>specify the <b>IDs of the elements</b> which will be extruded
<ul>
<li><b>Select the whole mesh, sub-mesh or group</b> activating the corresponding check-box; 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>Define the \b Path along which the elements will be extruded.<br>
Path definition consists of several elements:
<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>Activate <b>Generate Groups</b> check-box if it is necessary to copy the groups of
elements of the source mesh to the newly created one. </li>
<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 extruded, 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>Define the \b Path along which the elements will be extruded.<br>
Path definition consists of several elements:
<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>
</li>
<li>There are two optional parameters, which can be very useful:
<ul>
<li>If the path of extrusion is curvilinear, at each iteration 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
the mass center of the elements, however, you can specify any point as
the <b>Base Point</b> and the elements will be rotated with respect to this
point.<br>
Note that only the displacement of the <b>Base Point</b> exactly equals to the
path, and all other extruded elements simply keep their position relatively to the <b>Base Point</b> at each iteration.
</li>
<li>The elements can also be rotated around the path to get the resulting
mesh in a helical fashion. You can set the values of 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.
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 the mass center of the elements, however, you can
specify any point as the <b>Base Point</b> and the elements will be
rotated with respect to this point.<br>
Note that only the displacement of the <b>Base Point</b> exactly
equals to the path, and all other extruded elements simply keep
their position relatively to the <b>Base Point</b> at each
iteration.</li>
<li>The elements can also be rotated around the path to get the
resulting mesh in a helical fashion. You can set the values of
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
<center><em>"Add" button</em></center>
\image html remove.png
<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.
At each step the elements will be rotated by <code>angle / nb. of steps</code>.
<b>Linear variation of the angles</b> option allows defining the angle
of gradual rotation for the whole path. At each step the elements will
be rotated by <code>angle / nb. of steps</code>.
</li>
</ul>
</li>
<li>Click \b Apply or <b> Apply and Close</b> button to confirm the operation.
Mesh edges will be extruded into
faces, faces into volumes. The external surface of the resulting 3d
mesh (if faces have been extruded) is covered with faces, and corners
with edges. If the path is closed, the resulting mesh can contain
duplicated nodes and faces, because no sewing is done.
<li>Click \b Apply or <b> Apply and Close</b> button to confirm the
operation. Mesh edges will be extruded into faces, faces into
volumes. The external surface of the resulting 3d mesh (if faces
have been extruded) is covered with faces, and corners with
edges. If the path is closed, the resulting mesh can contain
duplicated nodes and faces, because no sewing is done.
</li>
</ol>

View File

@ -2,16 +2,16 @@
\page revolution_page Revolution
\n Revolution is a type of surface meshing by generation from
discretized lines. It is used to build mesh elements of plus one
dimension than the swept ones. Each swept 1D element produces one or
more quadrangles (or triangles if one node of a rotated element lays
on the revolution axis).
\n Revolution is used to build mesh elements of plus one
dimension than the input ones. Boundary elements around generated
mesh of plus one dimension are additionally created. All created
elements can be automatically grouped. Revolution can be used to create
a \ref extrusion_struct "structured mesh from scratch".
<em>To apply revolution:</em>
<ol>
<li>From the \b Modification menu choose the \b Revolution item or click
<em>"Revolution"</em> button in the toolbar.
<li>From the \b Modification menu choose the \b Revolution item or click
<em>"Revolution"</em> button in the toolbar.
\image html image92.png
<center><em>"Revolution" button</em></center>
@ -20,64 +20,90 @@ The following dialog common for line and planar elements will appear:
\image html revolution1.png
</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>
<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"
<li> Total Angle - the elements are extruded by the 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 extruded by 30/2=15 degrees twice for a total of 30). </li>
</li>
<li> <b>Total Angle</b> - the elements are revolved by the
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"
</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>
<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>
<li>Click \b Apply or <b> Apply and Close</b> button to confirm the
operation.</li>
</ol>
<br><b>See Also</b> a sample TUI Script of a
\ref tui_revolution "Revolution" operation.

View File

@ -40,20 +40,20 @@ module SMESH
{
/*!
* 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);
/*!
* 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
*/
long_array GetLastCreatedNodes() raises (SALOME::SALOME_Exception);
/*!
* 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
*/
long_array GetLastCreatedElems() raises (SALOME::SALOME_Exception);
@ -402,198 +402,73 @@ module SMESH
void RenumberElements() raises (SALOME::SALOME_Exception);
/*!
* \brief Genarate dim+1 elements by rotation of given elements around axis
* \param IDsOfElements - elements to ratate
* \param Axix - rotation axis
* \param AngleInRadians - rotation angle
* \param NbOfSteps - number of elements to generate from one element
* \brief Generate dim+1 elements by rotation of the object around axis
* \param Nodes - nodes to revolve: a list including groups, sub-meshes or a mesh
* \param Edges - edges to revolve: a list including groups, sub-meshes or a mesh
* \param Faces - faces to revolve: a list including groups, sub-meshes or a mesh
* \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,
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 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)
ListOfGroups RotationSweepObjects(in ListOfIDSources Nodes,
in ListOfIDSources Edges,
in ListOfIDSources Faces,
in AxisStruct Axis,
in double AngleInRadians,
in long NbOfSteps,
in double Tolerance,
in boolean ToMakeGroups)
raises (SALOME::SALOME_Exception);
void ExtrusionSweepObject(in SMESH_IDSource theObject,
in DirStruct StepVector,
in long NbOfSteps)
raises (SALOME::SALOME_Exception);
ListOfGroups ExtrusionSweepObjectMakeGroups(in SMESH_IDSource theObject,
in DirStruct StepVector,
in long NbOfSteps)
/*!
* \brief Generate dim+1 elements by extrusion of elements along vector
* \param nodes - nodes to extrude: a list including groups, sub-meshes or a mesh
* \param edges - edges to extrude: a list including groups, sub-meshes or a mesh
* \param faces - faces to extrude: a list including groups, sub-meshes or a mesh
* \param stepVector - vector giving direction and distance of an extrusion step
* \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);
void ExtrusionSweepObject0D(in SMESH_IDSource theObject,
in DirStruct StepVector,
in long NbOfSteps)
raises (SALOME::SALOME_Exception);
ListOfGroups ExtrusionSweepObject0DMakeGroups(in SMESH_IDSource theObject,
in DirStruct StepVector,
in long NbOfSteps)
/*! Generates new elements by extrusion along the normal to a discretized surface or wire
*/
ListOfGroups ExtrusionByNormal(in ListOfIDSources theObjects,
in double stepSize,
in long nbOfSteps,
in boolean byAverageNormal,
in boolean useInputElemsOnly,
in boolean makeGroups,
in short dim)
raises (SALOME::SALOME_Exception);
void ExtrusionSweepObject1D(in SMESH_IDSource theObject,
in DirStruct StepVector,
in long NbOfSteps)
raises (SALOME::SALOME_Exception);
ListOfGroups ExtrusionSweepObject1DMakeGroups(in SMESH_IDSource theObject,
in DirStruct StepVector,
in long NbOfSteps)
raises (SALOME::SALOME_Exception);
void ExtrusionSweepObject2D(in SMESH_IDSource theObject,
in DirStruct StepVector,
in long NbOfSteps)
raises (SALOME::SALOME_Exception);
ListOfGroups ExtrusionSweepObject2DMakeGroups(in SMESH_IDSource theObject,
in DirStruct StepVector,
in long NbOfSteps)
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)
/*!
* 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
* \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 AdvancedExtrusion(in long_array IDsOfElements,
in DirStruct StepVector,
in long NbOfSteps,
in long ExtrFlags,
in double SewTolerance,
in boolean ToMakeGroups)
raises (SALOME::SALOME_Exception);
enum Extrusion_Error {
@ -604,112 +479,21 @@ module SMESH
EXTR_BAD_STARTING_NODE,
EXTR_BAD_ANGLES_NUMBER,
EXTR_CANT_GET_TANGENT
};
};
ListOfGroups ExtrusionAlongPathX(in long_array IDsOfElements,
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);
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)
ListOfGroups ExtrusionAlongPathObjects(in ListOfIDSources Nodes,
in ListOfIDSources Edges,
in ListOfIDSources Faces,
in SMESH_IDSource Path,
in GEOM::GEOM_Object PathShape,
in long NodeStart,
in boolean HasAngles,
in double_array Angles,
in boolean LinearVariation,
in boolean HasRefPoint,
in PointStruct RefPoint,
in boolean MakeGroups,
out Extrusion_Error Error)
raises (SALOME::SALOME_Exception);
/*!

View File

@ -165,7 +165,22 @@ namespace MED
//---------------------------------------------------------------
TVWrapper::TVWrapper(const std::string& 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 );
}
}
//----------------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

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

View File

@ -22,22 +22,23 @@
#include "SMESHGUI_DisplayEntitiesDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_Utils.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_SelectionMgr.h>
#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 SPACING = 6;
@ -176,7 +177,7 @@ SMESHGUI_DisplayEntitiesDlg::~SMESHGUI_DisplayEntitiesDlg()
}
void SMESHGUI_DisplayEntitiesDlg::InverseEntityMode(unsigned int& theOutputMode,
unsigned int theMode)
unsigned int theMode)
{
bool anIsNotPresent = ~theOutputMode & theMode;
if(anIsNotPresent)
@ -193,7 +194,7 @@ void SMESHGUI_DisplayEntitiesDlg::onChangeEntityMode( bool isChecked )
QCheckBox* aSender = (QCheckBox*)sender();
if ( myNbCheckedButtons == 1 && !isChecked ) {
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)) );
aSender->setChecked( true );
connect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
@ -228,11 +229,13 @@ void SMESHGUI_DisplayEntitiesDlg::onHelp()
*/
void SMESHGUI_DisplayEntitiesDlg::onOk()
{
SUIT_OverrideCursor wc;
const char* entry = myIObject->getEntry();
if ( !myActor ) {
myActor = SMESH::CreateActor(SMESH::GetActiveStudyDocument(),
entry, true);
entry, true);
}
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 QPushButton;
class LightApp_SelectionMgr;
class SMESHGUI;
class SMESH_Actor;
class SMESHGUI_3TypesSelector;
class SMESHGUI_FilterDlg;
class SMESHGUI_IdValidator;
class SMESHGUI_SpinBox;
class SMESHGUI_FilterDlg;
class SVTK_Selector;
class LightApp_SelectionMgr;
class SMESH_Actor;
class SUIT_SelectionFilter;
class SVTK_Selector;
//=================================================================================
// class : SMESHGUI_ExtrusionAlongPathDlg
@ -75,13 +76,11 @@ private:
void Init( bool = true );
void enterEvent( QEvent* ); /* mouse enter the QWidget */
void keyPressEvent( QKeyEvent* );
int GetConstructorId();
void SetEditCurrentArgument( QToolButton* );
void SetEditCurrentArgument( QPushButton* );
bool isValid();
bool isValuesValid();
SMESH::long_array_var getSelectedElements();
SMESH::double_array_var getAngles();
void updateLinearAngles();
@ -89,38 +88,20 @@ private:
SMESHGUI_IdValidator* myIdValidator;
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
SVTK_Selector* mySelector;
QWidget* myEditCurrentArgument; /* Current argument */
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;
//GEOM::GEOM_Object_var myPathShape;
SUIT_SelectionFilter* myElementsFilter;
SUIT_SelectionFilter* myPathMeshFilter;
int myType;
QList<double> myAnglesList;
// widgets
QGroupBox* ConstructorsBox;
QButtonGroup* GroupConstructors;
QRadioButton* Elements1dRB;
QRadioButton* Elements2dRB;
SMESHGUI_3TypesSelector* SelectorWdg;
QGroupBox* GroupArguments;
QLabel* ElementsLab;
QToolButton* SelectElementsButton;
QLineEdit* ElementsLineEdit;
QCheckBox* MeshCheck;
QGroupBox* PathGrp;
QToolButton* SelectPathMeshButton;
QPushButton* SelectPathMeshButton;
QLineEdit* PathMeshLineEdit;
//QToolButton* SelectPathShapeButton;
//QLineEdit* PathShapeLineEdit;
QToolButton* SelectStartPointButton;
QPushButton* SelectStartPointButton;
QLineEdit* StartPointLineEdit;
QCheckBox* LinearAnglesCheck;
QGroupBox* AnglesGrp;
@ -129,7 +110,7 @@ private:
QToolButton* RemoveAngleButton;
SMESHGUI_SpinBox* AngleSpin;
QGroupBox* BasePointGrp;
QToolButton* SelectBasePointButton;
QPushButton* SelectBasePointButton;
SMESHGUI_SpinBox* XSpin;
SMESHGUI_SpinBox* YSpin;
SMESHGUI_SpinBox* ZSpin;
@ -143,27 +124,22 @@ private:
QString myHelpFileName;
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
protected slots:
void reject();
virtual void onDisplaySimulation( bool );
private slots:
void ConstructorsClicked( int );
void ClickOnOk();
bool ClickOnApply();
void ClickOnHelp();
void CheckIsEnable();
void SetEditCurrentArgument();
void SelectionIntoArgument();
void DeactivateActiveDialog();
void ActivateThisDialog();
void onTextChange( const QString& );
void onSelectMesh();
void OnAngleAdded();
void OnAngleRemoved();
void setFilters();
};
#endif // SMESHGUI_EXTRUSIONALONGPATHDLG_H

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,7 @@
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_PreviewDlg.h"
#include "SMESHGUI_Utils.h"
// SALOME GUI includes
#include <SALOME_InteractiveObject.hxx>
@ -57,15 +58,80 @@ class LightApp_SelectionMgr;
class SUIT_SelectionFilter;
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
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public SMESHGUI_PreviewDlg
{
Q_OBJECT
public:
public:
SMESHGUI_ExtrusionDlg( SMESHGUI* );
~SMESHGUI_ExtrusionDlg();
@ -81,39 +147,16 @@ private:
bool isValid();
bool isValuesValid();
SMESHGUI_IdValidator* myIdValidator;
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
QWidget* myEditCurrentArgument; /* Current argument editor */
int myNbOkElements; /* to check when elements are defined */
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
QGroupBox* ConstructorsBox;
QButtonGroup* GroupConstructors;
QRadioButton* Contructor_RBut0;
QRadioButton* Contructor_RBut1;
QRadioButton* Contructor_RBut2;
SMESHGUI_3TypesSelector* SelectorWdg;
QRadioButton* ExtrMethod_RBut0;
QRadioButton* ExtrMethod_RBut1;
QRadioButton* ExtrMethod_RBut2;
QGroupBox* GroupArguments;
QGroupBox* GroupDimensions;
QLabel* TextLabelElements;
QPushButton* SelectElementsButton;
QLineEdit* LineEditElements;
QCheckBox* CheckBoxMesh;
QLabel* TextLabelVector;
QLabel* TextLabelDistance;
QPushButton* SelectVectorButton;
@ -146,15 +189,11 @@ private:
QString myHelpFileName;
QString myIDs;
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
protected slots:
virtual void onDisplaySimulation( bool );
virtual void reject();
private slots:
void ConstructorsClicked( int );
void CheckIsEnable();
void ClickOnOk();
bool ClickOnApply();
@ -164,9 +203,6 @@ private slots:
void SelectionIntoArgument();
void DeactivateActiveDialog();
void ActivateThisDialog();
void onTextChange( const QString& );
void onSelectMesh( bool );
void setFilters();
};
#endif // SMESHGUI_EXTRUSIONDLG_H

View File

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

View File

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

View File

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

View File

@ -519,8 +519,8 @@ void SMESHGUI_MinDistance::secondEdited()
void SMESHGUI_MinDistance::compute()
{
SUIT_OverrideCursor wc;
SMESH::SMESH_IDSource_wrap s1;
SMESH::SMESH_IDSource_wrap s2;
SMESH::IDSource_wrap s1;
SMESH::IDSource_wrap s2;
bool isOrigin = mySecond->checkedId() == OriginTgt;
// process first target
@ -760,7 +760,8 @@ void SMESHGUI_BoundingBox::updateSelection()
sourceEdited();
//selectionChanged();
if ( mySource->text().isEmpty() )
selectionChanged();
}
/*!
@ -1206,6 +1207,9 @@ void SMESHGUI_BasicProperties::updateSelection()
selMgr->installFilter( myFilter );
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 )
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 );
return true;
}
@ -1619,7 +1619,7 @@ bool SMESHGUI_SplitVolumesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
const SMESH::long_array& theIds,
SMESH::SMESH_IDSource_ptr theObj)
{
SMESH::SMESH_IDSource_wrap obj = theObj;
SMESH::IDSource_wrap obj = theObj;
if ( CORBA::is_nil( obj ))
obj = theEditor->MakeIDSource( theIds, SMESH::VOLUME );
else

View File

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

View File

@ -35,6 +35,7 @@
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_MeshEditPreview.h"
#include "SMESHGUI_FilterDlg.h"
#include "SMESHGUI_ExtrusionDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
@ -91,17 +92,10 @@
SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
: SMESHGUI_PreviewDlg( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myVectorDefinition(NONE_SELECT),
myFilterDlg( 0 ),
mySelectedObject(SMESH::SMESH_IDSource::_nil()),
myActor(0)
myVectorDefinition(NONE_SELECT)
{
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
QPixmap image0 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
QPixmap image1 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
QPixmap image2 ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
QPixmap image ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
setModal(false);
setAttribute(Qt::WA_DeleteOnClose, true);
@ -113,44 +107,13 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
SMESHGUI_RevolutionDlgLayout->setMargin(MARGIN);
/***************************************************************/
ConstructorsBox = new QGroupBox(tr("SMESH_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);
GroupArguments = new QGroupBox(tr("REVOLUTION"), this);
QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
GroupArgumentsLayout->setSpacing(SPACING);
GroupArgumentsLayout->setMargin(MARGIN);
myIdValidator = new SMESHGUI_IdValidator(this);
// Controls for elements selection
TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), 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);
SelectorWdg = new SMESHGUI_3TypesSelector( GroupArguments );
// Controls for axis defining
GroupAxis = new QGroupBox(tr("SMESH_AXIS"), GroupArguments);
@ -160,7 +123,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
TextLabelPoint = new QLabel(tr("SMESH_POINT"), GroupAxis);
SelectPointButton = new QPushButton(GroupAxis);
SelectPointButton->setIcon(image2);
SelectPointButton->setIcon(image);
SelectPointButton->setCheckable(true);
TextLabelX = new QLabel(tr("SMESH_X"), GroupAxis);
SpinBox_X = new SMESHGUI_SpinBox(GroupAxis);
@ -173,7 +137,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupAxis);
SelectVectorButton = new QPushButton(GroupAxis);
SelectVectorButton->setIcon(image2);
SelectVectorButton->setIcon(image);
SelectVectorButton->setCheckable(true);
TextLabelDX = new QLabel(tr("SMESH_DX"), 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->setChecked(true);
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
GroupArgumentsLayout->addWidget(myFilterBtn, 0, 3);
GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4);
GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 4);
GroupArgumentsLayout->addWidget(GroupAngleBox, 3, 0, 1, 4);
GroupArgumentsLayout->addWidget(TextLabelTolerance, 4, 0, 1, 2);
GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 4, 2, 1, 2);
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 5, 0, 1, 4);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 6, 0, 1, 4);
GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0, 1, 4);
GroupArgumentsLayout->addWidget(GroupAxis, 1, 0, 1, 4);
GroupArgumentsLayout->addWidget(GroupAngleBox, 2, 0, 1, 4);
GroupArgumentsLayout->addWidget(TextLabelTolerance, 3, 0, 1, 2);
GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 3, 2, 1, 2);
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 4, 0, 1, 4);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0, 1, 4);
SelectorWdg->GetButtonGroup()->addButton( SelectVectorButton );
SelectorWdg->GetButtonGroup()->addButton( SelectPointButton );
/***************************************************************/
GroupButtons = new QGroupBox(this);
@ -274,7 +238,6 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
GroupButtonsLayout->addWidget(buttonHelp);
/***************************************************************/
SMESHGUI_RevolutionDlgLayout->addWidget(ConstructorsBox);
SMESHGUI_RevolutionDlgLayout->addWidget(GroupArguments);
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");
RadioButton1->setChecked(true);
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
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";
Init();
@ -326,9 +276,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
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(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_Z, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(CheckIsEnable()));
connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(CheckIsEnable()));
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(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog()));
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 */
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(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&)));
ConstructorsClicked(0);
SelectionIntoArgument();
CheckIsEnable();
}
//=================================================================================
@ -367,12 +317,6 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
//=================================================================================
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)
{
myBusy = false;
myEditCurrentArgument = 0;
LineEditElements->clear();
myElementsId = "";
myNbOkElements = 0;
myIDs.clear();
myActor = 0;
myMesh = SMESH::SMESH_Mesh::_nil();
if (ResetControls) {
SpinBox_X->SetValue(0.0);
SpinBox_Y->SetValue(0.0);
@ -404,68 +337,51 @@ void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
SpinBox_NbSteps->setValue(1);
SpinBox_Tolerance->SetValue(1e-05);
CheckBoxMesh->setChecked(false);
onSelectMesh(false);
myPreviewCheckBox->setChecked(false);
onDisplaySimulation(false);
}
SelectorWdg->Clear();
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
// function : CheckIsEnable()
// purpose : Check whether the Ok and Apply buttons should be enabled or not
//=================================================================================
void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
void SMESHGUI_RevolutionDlg::CheckIsEnable()
{
disconnect(mySelectionMgr, 0, this, 0);
bool anIsEnable = SelectorWdg->IsAnythingSelected() && IsAxisOk();
/* SALOME_ListIO io;
mySelectionMgr->selectedObjects( io );
SALOME_ListIO aList;
mySelectionMgr->setSelectedObjects( aList );*/
buttonOk->setEnabled(anIsEnable);
buttonApply->setEnabled(anIsEnable);
}
buttonApply->setEnabled(false);
buttonOk->setEnabled(false);
mySimulation->SetVisibility(false);
//=================================================================================
// function : isValid
// purpose : Return true in case if values entered into dialog are valid
//=================================================================================
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;
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;
}
if( !ok ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return false;
}
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 );
return true;
}
//=================================================================================
@ -480,14 +396,7 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply()
if (!isValid())
return false;
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();
if ( SelectorWdg->IsAnythingSelected() && IsAxisOk() ) {
SMESH::AxisStruct anAxis;
@ -498,8 +407,8 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply()
anAxis.vy = SpinBox_DY->GetValue();
anAxis.vz = SpinBox_DZ->GetValue();
double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.;
long aNbSteps = (long)SpinBox_NbSteps->value();
double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.;
long aNbSteps = (long)SpinBox_NbSteps->value();
double aTolerance = SpinBox_Tolerance->GetValue();
if ( GroupAngle->checkedId() == 1 )
@ -517,75 +426,60 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply()
aParameters << SpinBox_Tolerance->text();
bool meshHadNewTypeBefore = true;
int maxSelType = 0;
const bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
try {
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?
SMESH::ElementType newType = (SMESH::ElementType)( SMESH::FACE + GetConstructorId() );
SMESH::array_of_ElementType_var oldTypes = myMesh->GetTypes();
SMESH::ElementType newType = (SMESH::ElementType)( maxSelType + 1 );
SMESH::array_of_ElementType_var oldTypes = mesh->GetTypes();
meshHadNewTypeBefore = false;
for ( size_t i = 0; i < oldTypes->length() && !meshHadNewTypeBefore; ++i )
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() ) {
if( CheckBoxMesh->isChecked() ) {
if( GetConstructorId() == 0 )
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);
}
SMESH::ListOfGroups_var groups =
aMeshEditor->RotationSweepObjects( nodes, edges, faces, anAxis,
anAngle, aNbSteps, aTolerance, makeGroups);
} catch (...) {
}
if ( myActor && !meshHadNewTypeBefore )
SMESH_Actor* actor = SelectorWdg->GetActor();
if ( actor && !meshHadNewTypeBefore )
{
unsigned int aMode = myActor->GetEntityMode();
switch ( GetConstructorId() ) {
case 0-1: // extrude node -> edges
myActor->SetRepresentation(SMESH_Actor::eEdge);
myActor->SetEntityMode( aMode |= SMESH_Actor::eEdges ); break;
case 1-1: // edge -> faces
myActor->SetRepresentation(SMESH_Actor::eSurface);
myActor->SetEntityMode( aMode |= SMESH_Actor::eFaces ); break;
case 2-1: // faces -> volumes
myActor->SetRepresentation(SMESH_Actor::eSurface);
myActor->SetEntityMode( aMode |= SMESH_Actor::eVolumes ); break;
unsigned int aMode = actor->GetEntityMode();
switch ( maxSelType ) {
case SMESH::NODE: // extrude node -> edges
actor->SetRepresentation(SMESH_Actor::eEdge);
actor->SetEntityMode( aMode |= SMESH_Actor::eEdges ); break;
case SMESH::EDGE: // edge -> faces
actor->SetRepresentation(SMESH_Actor::eSurface);
actor->SetEntityMode( aMode |= SMESH_Actor::eFaces ); break;
case SMESH::FACE: // faces -> volumes
actor->SetRepresentation(SMESH_Actor::eSurface);
actor->SetEntityMode( aMode |= SMESH_Actor::eVolumes ); break;
}
}
SMESH::UpdateView();
SMESH::Update(myIO, SMESH::eDisplay);
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
if ( actor )
SMESH::Update( actor->getIO(), actor->GetVisibility() );
if ( makeGroups )
mySMESHGUI->updateObjBrowser(true); // new groups may appear
Init(false);
mySelectionMgr->clearSelected();
mySelectedObject = SMESH::SMESH_IDSource::_nil();
SelectionIntoArgument();
ConstructorsClicked(GetConstructorId());
SelectorWdg->Clear();
SMESHGUI::Modified();
}
@ -660,137 +554,38 @@ void SMESHGUI_RevolutionDlg::onAngleTextChange (const QString& theNewText)
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()
// purpose : Called when selection as changed or other case
//=================================================================================
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
return;
// get selected mesh
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList);
int nbSel = aList.Extent();
if (nbSel != 1)
return;
Handle(SALOME_InteractiveObject) IO = aList.First();
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)
if ( SelectVectorButton->isChecked() ||
SelectPointButton->isChecked() )
{
// get selected mesh
SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList);
int nbSel = aList.Extent();
if (nbSel != 1)
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 ||
(myEditCurrentArgument == (QWidget*)SpinBox_DX &&
myVectorDefinition==POINT_SELECT));
@ -798,21 +593,11 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
bool isFaceSelected = (myEditCurrentArgument == (QWidget*)SpinBox_DX &&
myVectorDefinition==FACE_SELECT);
if(isNodeSelected) {
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
}
else if(isFaceSelected){
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
}
if (aNbUnits != 1)
return;
if(isNodeSelected) {
const SMDS_MeshNode * n = aMesh->FindNode(aString.toInt());
if ( isNodeSelected )
{
const SMDS_MeshNode * n = aMesh->FindNode( aMapIndex(1) );
if (!n)
return;
double x = n->X();
double y = n->Y();
double z = n->Z();
@ -827,11 +612,12 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
SpinBox_DZ->SetValue(z - SpinBox_Z->GetValue());
}
}
else if(isFaceSelected){
const SMDS_MeshFace* face = dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aString.toInt()));
else if ( isFaceSelected )
{
const SMDS_MeshFace* face =
dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aMapIndex(1)));
if (!face)
return;
gp_XYZ aNormale = SMESH::getNormale(face);
SpinBox_DX->SetValue(aNormale.X());
SpinBox_DY->SetValue(aNormale.Y());
@ -840,17 +626,7 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
}
}
myBusy = true;
if (myEditCurrentArgument == (QWidget*)LineEditElements)
LineEditElements->setText(aString);
myBusy = false;
// OK
if (myNbOkElements && IsAxisOk()) {
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
}
CheckIsEnable();
onDisplaySimulation(true);
}
@ -866,35 +642,13 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
mySelectionMgr->clearSelected();
mySelectionMgr->clearFilters();
if (send == SelectElementsButton) {
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) {
if (send == SelectPointButton) {
myEditCurrentArgument = (QWidget*)SpinBox_X;
myEditCurrentArgument->setFocus();
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(NodeSelection);
}
myEditCurrentArgument->setFocus();
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
SelectionIntoArgument();
}
@ -905,10 +659,11 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
//=================================================================================
void SMESHGUI_RevolutionDlg::DeactivateActiveDialog()
{
if (ConstructorsBox->isEnabled()) {
ConstructorsBox->setEnabled(false);
if (GroupButtons->isEnabled())
{
GroupArguments->setEnabled(false);
GroupButtons->setEnabled(false);
SelectorWdg->setEnabled(false);
mySMESHGUI->ResetState();
mySMESHGUI->SetActiveDialogBox(0);
}
@ -922,14 +677,11 @@ void SMESHGUI_RevolutionDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate the active dialog */
mySMESHGUI->EmitSignalDeactivateDialog();
ConstructorsBox->setEnabled(true);
GroupArguments->setEnabled(true);
GroupButtons->setEnabled(true);
SelectorWdg->setEnabled(true);
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
ConstructorsClicked(GetConstructorId());
SelectionIntoArgument();
}
//=================================================================================
@ -938,73 +690,10 @@ void SMESHGUI_RevolutionDlg::ActivateThisDialog()
//=================================================================================
void SMESHGUI_RevolutionDlg::enterEvent (QEvent*)
{
if (!ConstructorsBox->isEnabled())
if (!GroupButtons->isEnabled())
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()
// purpose :
@ -1016,22 +705,6 @@ bool SMESHGUI_RevolutionDlg::IsAxisOk()
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()
// purpose :
@ -1056,17 +729,8 @@ void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
{
if (myPreviewCheckBox->isChecked() && toDisplayPreview)
{
//display preview
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;
anAxis.x = SpinBox_X->GetValue();
@ -1076,33 +740,34 @@ void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
anAxis.vy = SpinBox_DY->GetValue();
anAxis.vz = SpinBox_DZ->GetValue();
double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.;
long aNbSteps = (long)SpinBox_NbSteps->value();
double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.;
long aNbSteps = (long)SpinBox_NbSteps->value();
double aTolerance = SpinBox_Tolerance->GetValue();
if (GroupAngle->checkedId() == 1)
anAngle = anAngle/aNbSteps;
try {
try
{
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
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);
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
mySimulation->SetData(aMeshPreviewStruct._retn());
} catch (...) {}
SMESH::SMESH_Mesh_var mesh = SelectorWdg->GetMesh();
SMESH::SMESH_MeshEditor_var meshEditor = mesh->GetMeshEditPreviewer();
SMESH::ListOfGroups_var groups;
SMESH::ListOfIDSources_var nodes = new SMESH::ListOfIDSources();
SMESH::ListOfIDSources_var edges = new SMESH::ListOfIDSources();
SMESH::ListOfIDSources_var faces = new SMESH::ListOfIDSources();
SelectorWdg->GetSelected( nodes, edges, faces );
const bool makeGroups = false;
meshEditor->RotationSweepObjects(nodes, edges, faces,
anAxis, anAngle, aNbSteps, aTolerance, makeGroups );
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData();
mySimulation->SetData( aMeshPreviewStruct._retn() );
}
catch (...) {}
}
else
{
@ -1120,7 +785,8 @@ void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
// function : onSelectVectorButton()
// purpose : [slot]
//=================================================================================
void SMESHGUI_RevolutionDlg::onSelectVectorButton(){
void SMESHGUI_RevolutionDlg::onSelectVectorButton()
{
if(SelectVectorMenu) {
SelectVectorMenu->exec( QCursor::pos() );
}
@ -1130,7 +796,8 @@ void SMESHGUI_RevolutionDlg::onSelectVectorButton(){
// function : onSelectVectorMenu()
// purpose : [slot]
//=================================================================================
void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action){
void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action)
{
if(!action)
return;
@ -1157,58 +824,4 @@ void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action){
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 CORBA_SERVER_HEADER(SMESH_Mesh)
class LightApp_SelectionMgr;
class QAction;
class QButtonGroup;
class QCheckBox;
class QGroupBox;
class QLabel;
class QLineEdit;
class QMenu;
class QPushButton;
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 SMESHGUI;
class SMESHGUI_3TypesSelector;
class SMESHGUI_FilterDlg;
class SMESHGUI_IdValidator;
class SMESHGUI_MeshEditPreview;
class QMenu;
class QAction;
class SMESHGUI_SpinBox;
class SMESH_Actor;
class SMESH_LogicalFilter;
class SVTK_Selector;
class SalomeApp_IntSpinBox;
//=================================================================================
// class : SMESHGUI_RevolutionDlg
@ -85,27 +86,11 @@ private:
bool isValid();
SMESHGUI_IdValidator* myIdValidator;
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
int myNbOkElements; /* to check when elements are defined */
QString myElementsId;
QWidget* myEditCurrentArgument; /* Current argument */
SVTK_Selector* mySelector;
Handle(SALOME_InteractiveObject) myIO;
QWidget* myEditCurrentArgument; /* Current argument */
SMESH::SMESH_IDSource_var mySelectedObject;
bool myBusy;
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;
SMESHGUI_3TypesSelector* SelectorWdg;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
@ -113,10 +98,6 @@ private:
QPushButton* buttonHelp;
QGroupBox* GroupArguments;
QGroupBox* GroupAxis;
QLabel* TextLabelElements;
QPushButton* SelectElementsButton;
QLineEdit* LineEditElements;
QCheckBox* CheckBoxMesh;
QCheckBox* MakeGroupsCheck;
QGroupBox* GroupAngleBox;
QButtonGroup* GroupAngle;
@ -153,17 +134,13 @@ private:
QString myHelpFileName;
QString myIDs;
QPushButton* myFilterBtn;
SMESHGUI_FilterDlg* myFilterDlg;
protected slots:
virtual void onDisplaySimulation( bool );
virtual void reject();
virtual void reject();
private slots:
void ConstructorsClicked( int );
void CheckIsEnable();
void ClickOnOk();
bool ClickOnApply();
void ClickOnHelp();
@ -171,13 +148,9 @@ private slots:
void SelectionIntoArgument();
void DeactivateActiveDialog();
void ActivateThisDialog();
void onTextChange( const QString& );
void onAngleTextChange( const QString& );
void onSelectMesh( bool );
void onVectorChanged();
void onSelectVectorMenu( QAction* );
void onSelectVectorButton();
void setFilters();
};
#endif // SMESHGUI_REVOLUTIONDLG_H

View File

@ -486,7 +486,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
}
else {
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() );
aMeshEditor->Scale( src, aPoint, aScaleFact, false);
}
@ -503,7 +503,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
}
else {
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());
groups = aMeshEditor->ScaleMakeGroups( src, aPoint, aScaleFact);
}
@ -518,7 +518,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
}
else {
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());
aMeshEditor->Scale( src, aPoint, aScaleFact, true);
}
@ -541,7 +541,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
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,
LineEditNewMesh->text().toLatin1().data());
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
@ -1147,7 +1147,7 @@ void SMESHGUI_ScaleDlg::onDisplaySimulation( bool toDisplayPreview ) {
}
else {
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);
aMeshPreviewStruct << aMeshEditor->GetPreviewData();
}

View File

@ -182,7 +182,7 @@ SMESHGUI_EXPORT
// 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

View File

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

View File

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

View File

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

View File

@ -2413,6 +2413,7 @@ GetElementsId( SMESH_Mesh_ptr theMesh )
{
SMESH::long_array_var anArray = new SMESH::long_array;
if(!CORBA::is_nil(theMesh) && myPredicate){
theMesh->Load();
Controls::Filter::TIdSequence aSequence;
GetElementsId(myPredicate,theMesh,aSequence);
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 RenumberElements() throw (SALOME::SALOME_Exception);
void RotationSweep(const SMESH::long_array & IDsOfElements,
const SMESH::AxisStruct & Axis,
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance)
throw (SALOME::SALOME_Exception);
void RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
const SMESH::AxisStruct & Axis,
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)
SMESH::ListOfGroups* RotationSweepObjects(const SMESH::ListOfIDSources & nodes,
const SMESH::ListOfIDSources & edges,
const SMESH::ListOfIDSources & faces,
const SMESH::AxisStruct & Axis,
CORBA::Double AngleInRadians,
CORBA::Long NbOfSteps,
CORBA::Double Tolerance,
CORBA::Boolean toMakeGroups)
throw (SALOME::SALOME_Exception);
void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
const SMESH::DirStruct & StepVector,
CORBA::Long NbOfSteps)
throw (SALOME::SALOME_Exception);
void ExtrusionSweep0D(const SMESH::long_array & IDsOfElements,
const SMESH::DirStruct & StepVector,
CORBA::Long NbOfSteps)
SMESH::ListOfGroups* ExtrusionSweepObjects(const SMESH::ListOfIDSources & nodes,
const SMESH::ListOfIDSources & edges,
const SMESH::ListOfIDSources & faces,
const SMESH::DirStruct & stepVector,
CORBA::Long nbOfSteps,
CORBA::Boolean toMakeGroups)
throw (SALOME::SALOME_Exception);
void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
const SMESH::DirStruct & StepVector,
CORBA::Long NbOfSteps)
SMESH::ListOfGroups* ExtrusionByNormal(const SMESH::ListOfIDSources& objects,
CORBA::Double stepSize,
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);
void ExtrusionSweepObject0D(SMESH::SMESH_IDSource_ptr theObject,
const SMESH::DirStruct & StepVector,
CORBA::Long NbOfSteps)
throw (SALOME::SALOME_Exception);
void ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
const SMESH::DirStruct & StepVector,
CORBA::Long NbOfSteps)
throw (SALOME::SALOME_Exception);
void ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
const SMESH::DirStruct & StepVector,
CORBA::Long NbOfSteps)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionByNormal(SMESH::SMESH_IDSource_ptr object,
CORBA::Double stepSize,
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)
SMESH::ListOfGroups*
ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & nodes,
const SMESH::ListOfIDSources & edges,
const SMESH::ListOfIDSources & faces,
SMESH::SMESH_IDSource_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
CORBA::Long NodeStart,
CORBA::Boolean HasAngles,
const SMESH::double_array & Angles,
CORBA::Boolean LinearVariation,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct & RefPoint,
bool MakeGroups,
SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
throw (SALOME::SALOME_Exception);
SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
GEOM::GEOM_Object_ptr PathShape,
const SMESH::double_array & Angles);
GEOM::GEOM_Object_ptr PathShape,
const SMESH::double_array & Angles);
void Mirror(const SMESH::long_array & IDsOfElements,
const SMESH::AxisStruct & Axis,
@ -449,128 +391,6 @@ public:
CORBA::Boolean Copy)
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,
const SMESH::AxisStruct& Mirror,
SMESH::SMESH_MeshEditor::MirrorType MirrorType)
@ -1026,49 +846,6 @@ private: //!< private methods
SMESH::ListOfGroups* getGroups(const std::list<int>* groupIDs)
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,
const SMESH::AxisStruct & Axis,
SMESH::SMESH_MeshEditor::MirrorType MirrorType,
@ -1105,14 +882,25 @@ private: //!< private methods
SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
void dumpGroupsList(SMESH::TPythonDump & theDumpPython,
void dumpGroupsList(SMESH::TPythonDump & theDumpPython,
const SMESH::ListOfGroups * theGroupList);
string generateGroupName(const string& thePrefix);
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 * myMesh;

View File

@ -1077,14 +1077,35 @@ void SMESH_Mesh_i::RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
if ( theGroup->_is_nil() )
if ( theGroup->_is_nil() || theGroup->IsEmpty() )
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
SMESH::SMESH_IDSource_var idSrc = SMESH::SMESH_IDSource::_narrow( theGroup );
SMDS_ElemIteratorPtr elemIt = GetElements( idSrc, theGroup->GetType() );
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() );
}
// 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()
@ -6022,6 +6043,8 @@ SMESH_MeshPartDS::SMESH_MeshPartDS(SMESH::SMESH_IDSource_ptr meshPart):
}
myInfo = tmpInfo;
ShapeToMesh( _meshDS->ShapeToMesh() );
_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.
# Parameters are stored in AxisStruct.parameters attribute
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)
pass
SMESH.AxisStruct.__init__ = __initAxisStruct
@ -3515,6 +3518,56 @@ class Mesh:
def RenumberElements(self):
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
# @param IDsOfElements the list of ids of elements to sweep
# @param Axis the axis of rotation, AxisStruct or line(geom object)
@ -3528,9 +3581,15 @@ class Mesh:
# @ingroup l2_modif_extrurev
def RotationSweep(self, IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False):
unRegister = genObjUnRegister()
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)):
IDsOfElements = self.mesh
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)
AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
@ -3538,11 +3597,8 @@ class Mesh:
self.mesh.SetParameters(Parameters)
if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps
if MakeGroups:
return self.editor.RotationSweepMakeGroups(IDsOfElements, Axis,
AngleInRadians, NbOfSteps, Tolerance)
self.editor.RotationSweep(IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance)
return []
return self.editor.RotationSweepObjects([],[IDsOfElements],[IDsOfElements], Axis,
AngleInRadians, NbOfSteps, Tolerance, MakeGroups)
## Generates new elements by rotation of the elements of object around the axis
# @param theObject object which elements should be sweeped.
@ -3558,9 +3614,9 @@ class Mesh:
# @ingroup l2_modif_extrurev
def RotationSweepObject(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False):
if ( isinstance( theObject, Mesh )):
if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh()
if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)):
if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
Axis = self.smeshpyD.GetAxisStruct(Axis)
AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
@ -3568,11 +3624,8 @@ class Mesh:
self.mesh.SetParameters(Parameters)
if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps
if MakeGroups:
return self.editor.RotationSweepObjectMakeGroups(theObject, Axis, AngleInRadians,
NbOfSteps, Tolerance)
self.editor.RotationSweepObject(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance)
return []
return self.editor.RotationSweepObjects([],[theObject],[theObject], Axis,
AngleInRadians, NbOfSteps, Tolerance )
## Generates new elements by rotation of the elements of object around the axis
# @param theObject object which elements should be sweeped.
@ -3588,9 +3641,9 @@ class Mesh:
# @ingroup l2_modif_extrurev
def RotationSweepObject1D(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False):
if ( isinstance( theObject, Mesh )):
if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh()
if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)):
if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
Axis = self.smeshpyD.GetAxisStruct(Axis)
AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
@ -3598,11 +3651,8 @@ class Mesh:
self.mesh.SetParameters(Parameters)
if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps
if MakeGroups:
return self.editor.RotationSweepObject1DMakeGroups(theObject, Axis, AngleInRadians,
NbOfSteps, Tolerance)
self.editor.RotationSweepObject1D(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance)
return []
return self.editor.RotationSweepObjects([],[theObject],[], Axis,
AngleInRadians, NbOfSteps, Tolerance)
## Generates new elements by rotation of the elements of object around the axis
# @param theObject object which elements should be sweeped.
@ -3618,9 +3668,9 @@ class Mesh:
# @ingroup l2_modif_extrurev
def RotationSweepObject2D(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False):
if ( isinstance( theObject, Mesh )):
if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh()
if ( isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object)):
if isinstance( Axis, geomBuilder.GEOM._objref_GEOM_Object):
Axis = self.smeshpyD.GetAxisStruct(Axis)
AngleInRadians,AngleParameters,hasVars = ParseAngles(AngleInRadians)
NbOfSteps,Tolerance,Parameters,hasVars = ParseParameters(NbOfSteps,Tolerance)
@ -3628,11 +3678,37 @@ class Mesh:
self.mesh.SetParameters(Parameters)
if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps
if MakeGroups:
return self.editor.RotationSweepObject2DMakeGroups(theObject, Axis, AngleInRadians,
NbOfSteps, Tolerance)
self.editor.RotationSweepObject2D(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance)
return []
return self.editor.RotationSweepObjects([],[],[theObject], Axis, AngleInRadians,
NbOfSteps, Tolerance)
## Generates new elements by extrusion of the given elements and nodes
# @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
# @param IDsOfElements the list of elements ids for extrusion
@ -3646,7 +3722,13 @@ class Mesh:
# @ingroup l2_modif_extrurev
def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False, IsNodes = False):
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):
StepVector = self.smeshpyD.GetDirStruct(StepVector)
if isinstance( StepVector, list ):
@ -3654,46 +3736,14 @@ class Mesh:
NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
Parameters = StepVector.PS.parameters + var_separator + Parameters
self.mesh.SetParameters(Parameters)
if MakeGroups:
if(IsNodes):
return self.editor.ExtrusionSweepMakeGroups0D(IDsOfElements, StepVector, NbOfSteps)
else:
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 []
n,e,f = [],[],[]
if IsNodes: n = [IDsOfElements]
else : e,f, = [IDsOfElements],[IDsOfElements]
return self.editor.ExtrusionSweepObjects(n,e,f, StepVector, NbOfSteps, MakeGroups)
## Generates new elements by extrusion along the normal to a discretized surface or wire
# @param Elements container of elements to extrude;
# it can be Mesh, Group, Sub-mesh, Filter or list of IDs;
# Only faces can be extruded so far. Sub-mesh sould be a sub-mesh on geom faces.
# @param Elements elements to extrude - a list including ids, groups, sub-meshes or a mesh
# Only faces can be extruded so far. Sub-mesh should be a sub-mesh on geom faces.
# @param StepSize length of one extrusion step (the total extrusion
# length will be \a NbOfSteps * \a StepSize ).
# @param NbOfSteps number of extrusion steps.
@ -3715,14 +3765,15 @@ class Mesh:
ByAverageNormal=False, UseInputElemsOnly=True, MakeGroups=False, Dim = 2):
unRegister = genObjUnRegister()
if isinstance( Elements, Mesh ):
Elements = Elements.GetMesh()
Elements = [ Elements.GetMesh() ]
if isinstance( Elements, list ):
if not Elements:
raise RuntimeError, "List of element IDs is empty!"
if not isinstance( Elements[0], int ):
raise RuntimeError, "List must contain element IDs and not %s"% Elements[0]
Elements = self.GetIDSource( Elements, SMESH.ALL )
unRegister.set( Elements )
raise RuntimeError, "Elements empty!"
if isinstance( Elements[0], int ):
Elements = self.GetIDSource( Elements, SMESH.ALL )
unRegister.set( Elements )
else:
Elements = [ Elements ]
StepSize,NbOfSteps,Parameters,hasVars = ParseParameters(StepSize,NbOfSteps)
self.mesh.SetParameters(Parameters)
return self.editor.ExtrusionByNormal(Elements, StepSize, NbOfSteps,
@ -3736,29 +3787,23 @@ class Mesh:
# length will be NbOfSteps * ||StepVector||)
# @param NbOfSteps the number of steps
# @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
# @ingroup l2_modif_extrurev
def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False, IsNodes=False):
if ( isinstance( theObject, Mesh )):
if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh()
if ( isinstance( StepVector, geomBuilder.GEOM._objref_GEOM_Object)):
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)
if MakeGroups:
if(IsNodes):
return self.editor.ExtrusionSweepObject0DMakeGroups(theObject, StepVector, NbOfSteps)
else:
return self.editor.ExtrusionSweepObjectMakeGroups(theObject, StepVector, NbOfSteps)
if(IsNodes):
self.editor.ExtrusionSweepObject0D(theObject, StepVector, NbOfSteps)
else:
self.editor.ExtrusionSweepObject(theObject, StepVector, NbOfSteps)
return []
n,e,f = [],[],[]
if IsNodes: n = [theObject]
else : e,f, = [theObject],[theObject]
return self.editor.ExtrusionSweepObjects(n,e,f, StepVector, NbOfSteps, MakeGroups)
## Generates new elements by extrusion of the elements which belong to the object
# @param theObject object which elements should be processed.
@ -3780,10 +3825,8 @@ class Mesh:
NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
Parameters = StepVector.PS.parameters + var_separator + Parameters
self.mesh.SetParameters(Parameters)
if MakeGroups:
return self.editor.ExtrusionSweepObject1DMakeGroups(theObject, StepVector, NbOfSteps)
self.editor.ExtrusionSweepObject1D(theObject, StepVector, NbOfSteps)
return []
return self.editor.ExtrusionSweepObjects([],[theObject],[],
StepVector, NbOfSteps, MakeGroups)
## Generates new elements by extrusion of the elements which belong to the object
# @param theObject object which elements should be processed.
@ -3805,12 +3848,72 @@ class Mesh:
NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
Parameters = StepVector.PS.parameters + var_separator + Parameters
self.mesh.SetParameters(Parameters)
if MakeGroups:
return self.editor.ExtrusionSweepObject2DMakeGroups(theObject, StepVector, NbOfSteps)
self.editor.ExtrusionSweepObject2D(theObject, StepVector, NbOfSteps)
return []
return self.editor.ExtrusionSweepObjects([],[],[theObject],
StepVector, NbOfSteps, MakeGroups)
## 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
# The path of extrusion must be a meshed edge.
@ -3845,23 +3948,30 @@ class Mesh:
Parameters = AnglesParameters + var_separator + RefPoint.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):
IDsOfElements = []
if Base == []: IDsOfElements = self.GetElementsId()
else: IDsOfElements = 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)
if Base:
Base = self.GetIDSource( Base, ElemType )
unRegister.set( Base )
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
@ -3887,28 +3997,26 @@ class Mesh:
MakeGroups=False, LinearVariation=False):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)):
if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
pass
if ( isinstance( PathMesh, Mesh )):
if isinstance( PathMesh, Mesh ):
PathMesh = PathMesh.GetMesh()
Angles,AnglesParameters,hasVars = ParseAngles(Angles)
Parameters = AnglesParameters + var_separator + RefPoint.parameters
self.mesh.SetParameters(Parameters)
if HasAngles and Angles and LinearVariation:
Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
pass
if MakeGroups:
return self.editor.ExtrusionAlongPathMakeGroups(IDsOfElements, PathMesh,
PathShape, NodeStart, HasAngles,
Angles, HasRefPoint, RefPoint)
return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh, PathShape,
NodeStart, HasAngles, Angles, HasRefPoint, RefPoint)
n,e,f = [],[IDsOfElements],[IDsOfElements]
gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape,
NodeStart, HasAngles, Angles,
LinearVariation,
HasRefPoint, RefPoint, MakeGroups)
if MakeGroups: return gr,er
return er
## Generates new elements by extrusion of the elements which belong to the object
# The path of extrusion must be a meshed edge.
# @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 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
@ -3927,25 +4035,21 @@ class Mesh:
def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False):
if ( isinstance( theObject, Mesh )):
if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh()
if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)):
if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
if ( isinstance( PathMesh, Mesh )):
if isinstance( PathMesh, Mesh ):
PathMesh = PathMesh.GetMesh()
Angles,AnglesParameters,hasVars = ParseAngles(Angles)
Parameters = AnglesParameters + var_separator + RefPoint.parameters
self.mesh.SetParameters(Parameters)
if HasAngles and Angles and LinearVariation:
Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
pass
if MakeGroups:
return self.editor.ExtrusionAlongPathObjectMakeGroups(theObject, PathMesh,
PathShape, NodeStart, HasAngles,
Angles, HasRefPoint, RefPoint)
return self.editor.ExtrusionAlongPathObject(theObject, PathMesh, PathShape,
NodeStart, HasAngles, Angles, HasRefPoint,
RefPoint)
n,e,f = [],[theObject],[theObject]
gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups)
if MakeGroups: return gr,er
return er
## Generates new elements by extrusion of the elements which belong to the object
# The path of extrusion must be a meshed edge.
@ -3969,25 +4073,21 @@ class Mesh:
def ExtrusionAlongPathObject1D(self, theObject, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False):
if ( isinstance( theObject, Mesh )):
if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh()
if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)):
if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
if ( isinstance( PathMesh, Mesh )):
if isinstance( PathMesh, Mesh ):
PathMesh = PathMesh.GetMesh()
Angles,AnglesParameters,hasVars = ParseAngles(Angles)
Parameters = AnglesParameters + var_separator + RefPoint.parameters
self.mesh.SetParameters(Parameters)
if HasAngles and Angles and LinearVariation:
Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
pass
if MakeGroups:
return self.editor.ExtrusionAlongPathObject1DMakeGroups(theObject, PathMesh,
PathShape, NodeStart, HasAngles,
Angles, HasRefPoint, RefPoint)
return self.editor.ExtrusionAlongPathObject1D(theObject, PathMesh, PathShape,
NodeStart, HasAngles, Angles, HasRefPoint,
RefPoint)
n,e,f = [],[theObject],[]
gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups)
if MakeGroups: return gr,er
return er
## Generates new elements by extrusion of the elements which belong to the object
# The path of extrusion must be a meshed edge.
@ -4020,16 +4120,12 @@ class Mesh:
Angles,AnglesParameters,hasVars = ParseAngles(Angles)
Parameters = AnglesParameters + var_separator + RefPoint.parameters
self.mesh.SetParameters(Parameters)
if HasAngles and Angles and LinearVariation:
Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
pass
if MakeGroups:
return self.editor.ExtrusionAlongPathObject2DMakeGroups(theObject, PathMesh,
PathShape, NodeStart, HasAngles,
Angles, HasRefPoint, RefPoint)
return self.editor.ExtrusionAlongPathObject2D(theObject, PathMesh, PathShape,
NodeStart, HasAngles, Angles, HasRefPoint,
RefPoint)
n,e,f = [],[],[theObject]
gr,er = self.editor.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart,
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups)
if MakeGroups: return gr,er
return er
## Creates a symmetrical copy of mesh elements
# @param IDsOfElements list of elements ids
@ -4360,7 +4456,9 @@ class Mesh:
return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,exceptNodes)
## 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
def MergeNodes (self, GroupsOfNodes):
self.editor.MergeNodes(GroupsOfNodes)
@ -4369,13 +4467,17 @@ class Mesh:
# @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]])
# @ingroup l2_modif_trsf
def FindEqualElements (self, MeshOrSubMeshOrGroup):
if ( isinstance( MeshOrSubMeshOrGroup, Mesh )):
def FindEqualElements (self, MeshOrSubMeshOrGroup=None):
if not MeshOrSubMeshOrGroup:
MeshOrSubMeshOrGroup=self.mesh
elif isinstance( MeshOrSubMeshOrGroup, Mesh ):
MeshOrSubMeshOrGroup = MeshOrSubMeshOrGroup.GetMesh()
return self.editor.FindEqualElements(MeshOrSubMeshOrGroup)
return self.editor.FindEqualElements( MeshOrSubMeshOrGroup )
## 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
def MergeElements(self, GroupsOfElementsID):
self.editor.MergeElements(GroupsOfElementsID)