\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:
<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
<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).
-
- \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_useonly.png
- <p></li>
+ 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 "'Along average normal' activated (to the left) and deactivated (to the right)"
+ <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
<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>
\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.
\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>
\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>
\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"
-
-</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>
+ </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>
+
+ <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
+<br><b>See Also</b> a sample TUI Script of a
\ref tui_revolution "Revolution" operation.
*/
{
/*!
* 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);
void ConvertFromQuadraticObject(in SMESH_IDSource theObject)
raises (SALOME::SALOME_Exception);
- void ConvertToBiQuadratic(in boolean theForce3d,
+ void ConvertToBiQuadratic(in boolean theForce3d,
in SMESH_IDSource theObject)
raises (SALOME::SALOME_Exception);
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
- */
- 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)
- 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)
- 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)
- 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)
+ * \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
+ */
+ 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);
+
+ /*!
+ * \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);
+
+ /*! 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);
+
+ /*!
+ * 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 {
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);
/*!
//---------------------------------------------------------------
- TVWrapper::TVWrapper(const std::string& theFileName):
+ 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 );
+ }
+ }
+
+
//----------------------------------------------------------------------------
TInt
TVWrapper
EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshGridStructRd(...)");
}
- }
+ }
}
}
-//=======================================================================
-//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
+ //=======================================================================
+
+ bool isReverse(const SMDS_MeshElement* face,
+ const vector<const SMDS_MeshNode*>& prevNodes,
+ const vector<const SMDS_MeshNode*>& nextNodes,
+ const int iNotSame)
+ {
- SMESH_TNodeXYZ pP = prevNodes[ iNotSame ];
- SMESH_TNodeXYZ pN = nextNodes[ iNotSame ];
- gp_XYZ extrDir( pN - pP ), faceNorm;
- SMESH_MeshAlgos::FaceNormal( face, faceNorm, /*normalized=*/false );
+ 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;
+ 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] );
+ }
+ }
}
//=======================================================================
//=======================================================================
SMESH_MeshEditor::PGroupIDs
-SMESH_MeshEditor::RotationSweep(TIDSortedElemSet & theElems,
+SMESH_MeshEditor::RotationSweep(TIDSortedElemSet theElemSets[2],
const gp_Ax1& theAxis,
const double theAngle,
const int theNbSteps,
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() );
+ // 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 );
+ 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 )
+ TNodeOfNodeListMapItr 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 )
+ // 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;
+ }
}
- }
- // 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] );
+ // 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 )
//=======================================================================
SMESH_MeshEditor::PGroupIDs
-SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet & theElems,
+SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet theElems[2],
const gp_Vec& theStep,
const int theNbSteps,
TTElemOfElemListMap& newElemsMap,
//=======================================================================
SMESH_MeshEditor::PGroupIDs
-SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet & theElems,
+SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet theElemSets[2],
ExtrusParam& theParams,
TTElemOfElemListMap& newElemsMap)
{
SMESHDS_Mesh* aMesh = GetMeshDS();
+ setElemsFirst( theElemSets );
const int nbSteps = theParams.NbSteps();
- theParams.SetElementsToUse( theElems );
+ theParams.SetElementsToUse( theElemSets[0] );
TNodeOfNodeListMap mapNewNodes;
//TNodeOfNodeVecMap mapNewNodes;
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;
+ TIDSortedElemSet& theElems = theElemSets[ is2ndSet ];
+ for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+ {
+ // 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 );
+ 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() )
+ // loop on elem nodes
+ SMDS_ElemIteratorPtr itN = elem->nodesIterator();
+ while ( itN->more() )
{
- // make new nodes
-
- // check if we are to create medium nodes between corner ones
- bool needMediumNodes = false;
- if ( isQuadraticMesh )
+ // 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 )
+ // create nodes for all steps
+ if ( theParams.MakeNodes( GetMeshDS(), node, listNewNodes, needMediumNodes ))
{
- myLastCreatedNodes.Append( *newNodesIt );
- srcNodes.Append( node );
+ 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
}
}
- 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() )
//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,
TNodeOfNodeListMap mapNewNodes;
// 1. Check data
- aNbE = theElements.size();
+ aNbE = theElements[0].size() + theElements[1].size();
// nothing to do
if ( !aNbE )
return EXTR_NO_ELEMENTS;
//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,
TNodeOfNodeListMap mapNewNodes;
// 1. Check data
- aNbE = theElements.size();
+ aNbE = theElements[0].size() + theElements[1].size();
// nothing to do
if ( !aNbE )
return EXTR_NO_ELEMENTS;
}
conn = nbEdgeConnectivity(theN1);
- if(conn > 2)
+ if( conn != 1 )
return EXTR_PATH_NOT_EDGE;
aItE = theN1->GetInverseElementIterator();
//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,
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();
// 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;
-
- vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ];
- newNodesItVec.reserve( elem->NbNodes() );
+ 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;
- // 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;
+ vector<TNodeOfNodeListMapItr> & newNodesItVec = mapElemNewNodes[ elem ];
+ newNodesItVec.reserve( elem->NbNodes() );
- // 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;
-
- 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;
-
- 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 );
-
- // 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 );
-
- aPN1 = aPN1.Transformed( aTrsfRotT1T0 );
- }
+ // 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;
+
+ aTolAng=1.e-4;
+
+ 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;
+
+ 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 );
+
+ // 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 );
+
+ 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 );
- }
- 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;
+ 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");
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,
* @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,
* 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);
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,
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,
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,
return false;
// get a mesh
- SMESH::SMESH_IDSource_wrap meshObject;
+ SMESH::IDSource_wrap meshObject;
SMESH::SMESH_Mesh_var mesh;
if ( !myIO.IsNull() )
{
try
{
SUIT_OverrideCursor aWaitCursor;
- SMESH::SMESH_IDSource_wrap aPartToCopy;
+
+ SMESH::IDSource_wrap aPartToCopy;
if ( myIdSourceCheck->isChecked())
{
aPartToCopy = mySelectedObject;
#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;
}
void SMESHGUI_DisplayEntitiesDlg::InverseEntityMode(unsigned int& theOutputMode,
- unsigned int theMode)
+ unsigned int theMode)
{
bool anIsNotPresent = ~theOutputMode & theMode;
if(anIsNotPresent)
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)) );
*/
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() ) {
#include "SMESHGUI_ExtrusionAlongPathDlg.h"
#include "SMESHGUI.h"
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_VTKUtils.h"
-#include "SMESHGUI_MeshUtils.h"
-#include "SMESHGUI_SpinBox.h"
-#include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_ExtrusionDlg.h" // for SMESHGUI_3TypesSelector
#include "SMESHGUI_FilterDlg.h"
+#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_MeshEditPreview.h"
+#include "SMESHGUI_MeshUtils.h"
+#include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_Session.h>
-
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
-
#include <SVTK_ViewWindow.h>
// OCCT includes
//=================================================================================
SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule )
: SMESHGUI_PreviewDlg( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myFilterDlg( 0 )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
- QPixmap edgeImage ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
- QPixmap faceImage ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
QPixmap selectImage ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
QPixmap addImage ( mgr->loadPixmap("SMESH", tr("ICON_APPEND")));
QPixmap removeImage ( mgr->loadPixmap("SMESH", tr("ICON_REMOVE")));
- myType = -1;
-
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
setWindowTitle(tr("EXTRUSION_ALONG_PATH"));
topLayout->setSpacing(SPACING);
topLayout->setMargin(MARGIN);
- /***************************************************************/
- // Elements type group box (1d / 2d elements)
- ConstructorsBox = new QGroupBox(tr("SMESH_EXTRUSION"), this);
- GroupConstructors = new QButtonGroup(this);
- QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
- ConstructorsBoxLayout->setSpacing(SPACING); ConstructorsBoxLayout->setMargin(MARGIN);
-
- Elements1dRB = new QRadioButton(ConstructorsBox);
- Elements1dRB->setIcon(edgeImage);
- Elements2dRB = new QRadioButton(ConstructorsBox);
- Elements2dRB->setIcon(faceImage);
- Elements1dRB->setChecked(true);
-
- // layouting
- ConstructorsBoxLayout->addWidget(Elements1dRB);
- ConstructorsBoxLayout->addWidget(Elements2dRB);
- GroupConstructors->addButton(Elements1dRB, 0);
- GroupConstructors->addButton(Elements2dRB, 1);
-
/***************************************************************/
// Arguments group box
- GroupArguments = new QGroupBox(tr("EXTRUSION_1D"), this);
+ GroupArguments = new QGroupBox(tr("SMESH_EXTRUSION"), this);
QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
GroupArgumentsLayout->setSpacing(SPACING); GroupArgumentsLayout->setMargin(MARGIN);
myIdValidator = new SMESHGUI_IdValidator(this);
// Controls for elements selection
- ElementsLab = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments);
-
- SelectElementsButton = new QToolButton(GroupArguments);
- SelectElementsButton->setIcon(selectImage);
-
- ElementsLineEdit = new QLineEdit(GroupArguments);
- ElementsLineEdit->setValidator(myIdValidator);
- ElementsLineEdit->setMaxLength(-1);
- myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
- connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
-
- // Controls for the whole mesh selection
- MeshCheck = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
-
+ SelectorWdg = new SMESHGUI_3TypesSelector( GroupArguments );
+
// Controls for path selection
PathGrp = new QGroupBox(tr("SMESH_PATH"), GroupArguments);
QGridLayout* PathGrpLayout = new QGridLayout(PathGrp);
// Controls for path mesh selection
QLabel* PathMeshLab = new QLabel(tr("SMESH_PATH_MESH"), PathGrp);
- SelectPathMeshButton = new QToolButton(PathGrp);
+ SelectPathMeshButton = new QPushButton(PathGrp);
SelectPathMeshButton->setIcon(selectImage);
+ SelectPathMeshButton->setCheckable(true);
PathMeshLineEdit = new QLineEdit(PathGrp);
PathMeshLineEdit->setReadOnly(true);
// Controls for path starting point selection
QLabel* StartPointLab = new QLabel(tr("SMESH_PATH_START"), PathGrp);
- SelectStartPointButton = new QToolButton(PathGrp);
+ SelectStartPointButton = new QPushButton(PathGrp);
SelectStartPointButton->setIcon(selectImage);
+ SelectStartPointButton->setCheckable(true);
StartPointLineEdit = new QLineEdit(PathGrp);
StartPointLineEdit->setValidator(new QIntValidator(this));
QHBoxLayout* BasePointGrpLayout = new QHBoxLayout(BasePointGrp);
BasePointGrpLayout->setSpacing(SPACING); BasePointGrpLayout->setMargin(MARGIN);
- SelectBasePointButton = new QToolButton(BasePointGrp);
+ SelectBasePointButton = new QPushButton(BasePointGrp);
SelectBasePointButton->setIcon(selectImage);
+ SelectBasePointButton->setCheckable(true);
+
+ SelectorWdg->GetButtonGroup()->addButton( SelectPathMeshButton );
+ SelectorWdg->GetButtonGroup()->addButton( SelectStartPointButton );
+ SelectorWdg->GetButtonGroup()->addButton( SelectBasePointButton );
QLabel* XLab = new QLabel(tr("SMESH_X"), BasePointGrp);
XSpin = new SMESHGUI_SpinBox(BasePointGrp);
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
// layouting
- GroupArgumentsLayout->addWidget(ElementsLab, 0, 0);
- GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
- GroupArgumentsLayout->addWidget(ElementsLineEdit, 0, 2);
- GroupArgumentsLayout->addWidget(myFilterBtn, 0, 3);
- GroupArgumentsLayout->addWidget(MeshCheck, 1, 0, 1, 4);
- GroupArgumentsLayout->addWidget(PathGrp, 2, 0, 1, 4);
- GroupArgumentsLayout->addWidget(BasePointGrp, 3, 0, 1, 4);
- GroupArgumentsLayout->addWidget(AnglesGrp, 4, 0, 1, 4);
- GroupArgumentsLayout->addWidget(myPreviewCheckBox, 5, 0, 1, 4);
- GroupArgumentsLayout->addWidget(MakeGroupsCheck, 6, 0, 1, 4);
+ GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0);
+ GroupArgumentsLayout->addWidget(PathGrp, 1, 0);
+ GroupArgumentsLayout->addWidget(BasePointGrp, 2, 0);
+ GroupArgumentsLayout->addWidget(AnglesGrp, 3, 0);
+ GroupArgumentsLayout->addWidget(myPreviewCheckBox, 4, 0);
+ GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0);
/***************************************************************/
// common buttons group box
/***************************************************************/
// layouting
- topLayout->addWidget(ConstructorsBox);
topLayout->addWidget(GroupArguments);
topLayout->addWidget(GroupButtons);
mySMESHGUI->SetActiveDialogBox(this);
- // Costruction of the logical filter for the elements: mesh/sub-mesh/group
- 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);
-
- myElementsFilter = new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
- //myPathMeshFilter = new SMESH_TypeFilter (SMESH::MESH);
myPathMeshFilter = new SMESH_TypeFilter(SMESH::MESHorSUBMESH);
myHelpFileName = "extrusion_along_path_page.html";
connect(AddAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleAdded()));
connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleRemoved()));
- connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
-
- connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectPathMeshButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectStartPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectBasePointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(BasePointGrp, SIGNAL(toggled(bool)), this, SLOT(SetEditCurrentArgument()));
- connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
- connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
+ connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject()));
+ 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()));
- connect(ElementsLineEdit, SIGNAL(textChanged(const QString&)),
- SLOT(onTextChange(const QString&)));
connect(StartPointLineEdit, SIGNAL(textChanged(const QString&)),
SLOT(onTextChange(const QString&)));
- connect(MeshCheck, SIGNAL(toggled(bool)), SLOT(onSelectMesh()));
-
connect(XSpin, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(YSpin, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(ZSpin, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
- connect(AddAngleButton, SIGNAL(clicked()), this, SLOT(toDisplaySimulation()));
+ connect(AddAngleButton, SIGNAL(clicked()), this, SLOT(toDisplaySimulation()));
connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(toDisplaySimulation()));
- connect(LinearAnglesCheck, SIGNAL(toggled(bool)), SLOT(onSelectMesh()));
+ //connect(LinearAnglesCheck, SIGNAL(toggled(bool)), SLOT(onSelectMesh()));
//To Connect preview check box
connectPreviewControl();
- AnglesList->installEventFilter(this);
- ElementsLineEdit->installEventFilter(this);
+ AnglesList ->installEventFilter(this);
StartPointLineEdit->installEventFilter(this);
- XSpin->editor()->installEventFilter(this);
- YSpin->editor()->installEventFilter(this);
- ZSpin->editor()->installEventFilter(this);
+ XSpin->editor() ->installEventFilter(this);
+ YSpin->editor() ->installEventFilter(this);
+ ZSpin->editor() ->installEventFilter(this);
+
+ CheckIsEnable();
}
//=================================================================================
SMESHGUI_ExtrusionAlongPathDlg::~SMESHGUI_ExtrusionAlongPathDlg()
{
// no need to delete child widgets, Qt does it all for us
- if ( myFilterDlg != 0 ) {
- myFilterDlg->setParent( 0 );
- delete myFilterDlg;
- }
}
//=================================================================================
myBusy = false;
myEditCurrentArgument = 0;
- myMesh = SMESH::SMESH_Mesh::_nil();
- myIDSource = SMESH::SMESH_IDSource::_nil();
- myMeshActor = 0;
- myPath = SMESH::SMESH_IDSource::_nil();
+ myPath = SMESH::SMESH_IDSource::_nil();
- ElementsLineEdit->clear();
+ SelectorWdg->Clear();
PathMeshLineEdit->clear();
StartPointLineEdit->clear();
ZSpin->SetValue(0.0);
AngleSpin->SetValue(45);
- MeshCheck->setChecked(false);
- ConstructorsClicked(0);
- onSelectMesh();
myPreviewCheckBox->setChecked(false);
onDisplaySimulation(false);
}
}
//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Called when user changes type of elements (1d / 2d)
+// function : CheckIsEnable()
+// purpose : Check whether the Ok and Apply buttons should be enabled or not
//=================================================================================
-void SMESHGUI_ExtrusionAlongPathDlg::ConstructorsClicked (int type)
-{
- if (myType == type) return;
-
- disconnect(mySelectionMgr, 0, this, 0);
- hidePreview();
+void SMESHGUI_ExtrusionAlongPathDlg::CheckIsEnable()
+{
+ bool anIsEnable = SelectorWdg->IsAnythingSelected() && isValuesValid();
- if (type == 0)
- GroupArguments->setTitle(tr("EXTRUSION_1D"));
- else if (type == 1)
- GroupArguments->setTitle(tr("EXTRUSION_2D"));
-
- // clear elements ID list
- if (!MeshCheck->isChecked()) {
- ElementsLineEdit->clear();
- }
- // set selection mode if necessary
- if (myEditCurrentArgument == ElementsLineEdit) {
- mySelectionMgr->clearSelected();
- mySelectionMgr->clearFilters();
- SMESH::SetPickable();
-
- SMESH::SetPointRepresentation(false);
- if (MeshCheck->isChecked()) {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(ActorSelection);
- mySelectionMgr->installFilter(myElementsFilter);
- } else {
- if (type == 0)
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
- }
- if (type == 1)
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- }
- }
- }
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-
- myType = type;
+ OkButton->setEnabled(anIsEnable);
+ ApplyButton->setEnabled(anIsEnable);
}
//=================================================================================
if (mySMESHGUI->isActiveStudyLocked())
return false;
- //if (myMesh->_is_nil() || MeshCheck->isChecked() && myIDSource->_is_nil() ||
- // !myMeshActor || myPathMesh->_is_nil() || myPathShape->_is_nil())
- if ( myMesh->_is_nil() || (MeshCheck->isChecked() && myIDSource->_is_nil()) ||
- /*!myMeshActor ||*/ myPath->_is_nil() )
+ if ( !SelectorWdg->IsAnythingSelected() || myPath->_is_nil() )
return false;
if (!isValid())
return false;
- SMESH::long_array_var anElementsId = getSelectedElements();
-
if (StartPointLineEdit->text().trimmed().isEmpty()) {
return false;
}
//get angles
SMESH::double_array_var anAngles = getAngles();
- for (int i = 0; i < myAnglesList.count(); i++)
+ for (int i = 0; i < myAnglesList.count(); i++)
aParameters << AnglesList->item(i)->text();
aBasePoint.y = YSpin->GetValue();
aBasePoint.z = ZSpin->GetValue();
}
-
aParameters << XSpin->text();
aParameters << YSpin->text();
aParameters << ZSpin->text();
+ bool meshHadNewTypeBefore = true;
+ int maxSelType = 0;
+ const bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
+
try {
SUIT_OverrideCursor wc;
- SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
- SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
-
- myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
-
- bool NeedGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
- SMESH::ElementType ElemType = SMESH::FACE;
- if( GetConstructorId() == 0 )
- ElemType = SMESH::EDGE;
- if( !MeshCheck->isChecked() ) {
- SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionAlongPathX(anElementsId, myPath, aNodeStart, AnglesGrp->isChecked(),
- anAngles, LinearAnglesCheck->isChecked(),
- BasePointGrp->isChecked(), aBasePoint,
- NeedGroups, ElemType, retVal);
- }
- else {
- SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionAlongPathObjX(myIDSource, myPath, aNodeStart, AnglesGrp->isChecked(),
- anAngles, LinearAnglesCheck->isChecked(),
- BasePointGrp->isChecked(), aBasePoint,
- NeedGroups, ElemType, retVal);
- }
-
-
- wc.suspend();
- switch (retVal) {
- case SMESH::SMESH_MeshEditor::EXTR_NO_ELEMENTS:
- SUIT_MessageBox::warning(this,
- tr("SMESH_ERROR"),
- tr("NO_ELEMENTS_SELECTED"));
- return false; break;
- case SMESH::SMESH_MeshEditor::EXTR_PATH_NOT_EDGE:
- SUIT_MessageBox::warning(this,
- tr("SMESH_ERROR"),
- tr("SELECTED_PATH_IS_NOT_EDGE"));
- return false; break;
- case SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE:
- SUIT_MessageBox::warning(this,
- tr("SMESH_ERROR"),
- tr("BAD_SHAPE_TYPE"));
- return false; break;
- case SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE:
- SUIT_MessageBox::warning(this,
- tr("SMESH_ERROR"),
- tr("EXTR_BAD_STARTING_NODE"));
- return false; break;
- case SMESH::SMESH_MeshEditor::EXTR_BAD_ANGLES_NUMBER:
- SUIT_MessageBox::warning(this,
- tr("SMESH_ERROR"),
- tr("WRONG_ANGLES_NUMBER"));
- return false; break;
- case SMESH::SMESH_MeshEditor::EXTR_CANT_GET_TANGENT:
- SUIT_MessageBox::warning(this,
- tr("SMESH_ERROR"),
- tr("CANT_GET_TANGENT"));
- return false; break;
- case SMESH::SMESH_MeshEditor::EXTR_OK:
- break;
- }
+ 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)( 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 = mesh->GetMeshEditor();
+ SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
+
+ SMESH::ListOfGroups_var groups =
+ aMeshEditor->ExtrusionAlongPathObjects( nodes, edges, faces, myPath,
+ GEOM::GEOM_Object::_nil(),
+ aNodeStart, AnglesGrp->isChecked(),
+ anAngles, LinearAnglesCheck->isChecked(),
+ BasePointGrp->isChecked(), aBasePoint,
+ makeGroups, retVal );
+
+ wc.suspend();
+ switch (retVal) {
+ case SMESH::SMESH_MeshEditor::EXTR_NO_ELEMENTS:
+ SUIT_MessageBox::warning(this,
+ tr("SMESH_ERROR"),
+ tr("NO_ELEMENTS_SELECTED"));
+ return false; break;
+ case SMESH::SMESH_MeshEditor::EXTR_PATH_NOT_EDGE:
+ SUIT_MessageBox::warning(this,
+ tr("SMESH_ERROR"),
+ tr("SELECTED_PATH_IS_NOT_EDGE"));
+ return false; break;
+ case SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE:
+ SUIT_MessageBox::warning(this,
+ tr("SMESH_ERROR"),
+ tr("BAD_SHAPE_TYPE"));
+ return false; break;
+ case SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE:
+ SUIT_MessageBox::warning(this,
+ tr("SMESH_ERROR"),
+ tr("EXTR_BAD_STARTING_NODE"));
+ return false; break;
+ case SMESH::SMESH_MeshEditor::EXTR_BAD_ANGLES_NUMBER:
+ SUIT_MessageBox::warning(this,
+ tr("SMESH_ERROR"),
+ tr("WRONG_ANGLES_NUMBER"));
+ return false; break;
+ case SMESH::SMESH_MeshEditor::EXTR_CANT_GET_TANGENT:
+ SUIT_MessageBox::warning(this,
+ tr("SMESH_ERROR"),
+ tr("CANT_GET_TANGENT"));
+ return false; break;
+ case SMESH::SMESH_MeshEditor::EXTR_OK:
+ break;
+ }
} catch (...) {
return false;
}
- //mySelectionMgr->clearSelected();
- if ( myMeshActor )
- SMESH::Update( myMeshActor->getIO(), myMeshActor->GetVisibility() );
-
- SMESHGUI::Modified();
-
- if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+ SMESH_Actor* actor = SelectorWdg->GetActor();
+ if ( actor && !meshHadNewTypeBefore )
+ {
+ 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;
+ }
+ }
+ if ( actor )
+ SMESH::Update( actor->getIO(), actor->GetVisibility() );
+ if ( makeGroups )
mySMESHGUI->updateObjBrowser(true); // new groups may appear
- //SMESH::UpdateView();
Init(false);
- ConstructorsClicked(GetConstructorId());
+ mySelectionMgr->clearSelected();
+ SelectorWdg->Clear();
+
+ SMESHGUI::Modified();
return true;
}
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySMESHGUI->ResetState();
+
QDialog::reject();
}
// set busy flag
SetBusy sb (this);
- if (send != StartPointLineEdit && send != ElementsLineEdit)
- send = ElementsLineEdit;
-
- if (send == ElementsLineEdit && myEditCurrentArgument == ElementsLineEdit) {
- // hilight entered elements
- SMDS_Mesh* aMesh = 0;
- if (myMeshActor)
- aMesh = myMeshActor->GetObject()->GetMesh();
-
- if (aMesh) {
- //mySelectionMgr->clearSelected();
- //mySelectionMgr->AddIObject(myMeshActor->getIO());
- SALOME_ListIO aList;
- aList.Append(myMeshActor->getIO());
- mySelectionMgr->setSelectedObjects(aList, false);
-
- QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
- bool bOk;
- const Handle(SALOME_InteractiveObject)& anIO = myMeshActor->getIO();
- TColStd_MapOfInteger newIndices;
- for (int i = 0; i < aListId.count(); i++) {
- long ind = aListId[ i ].toLong(&bOk);
- if (bOk) {
- const SMDS_MeshElement* e = aMesh->FindElement(ind);
- if (e) {
- // check also type of element
- bool typeMatch = (Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge) ||
- (Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face);
- if (typeMatch)
- newIndices.Add(e->GetID());
- }
- }
- }
- mySelector->AddOrRemoveIndex(anIO, newIndices, false);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( anIO, true, true );
- }
- }
- else if (send == StartPointLineEdit &&
- myEditCurrentArgument == StartPointLineEdit) {
+ if (send == StartPointLineEdit &&
+ myEditCurrentArgument == StartPointLineEdit)
+ {
if (!myPath->_is_nil()) {
SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPath);
- SMDS_Mesh* aMesh = 0;
- if (aPathActor)
- aMesh = aPathActor->GetObject()->GetMesh();
+ SMDS_Mesh* aMesh = aPathActor ? aPathActor->GetObject()->GetMesh() : 0;
if (aMesh) {
- //mySelectionMgr->clearSelected();
- //mySelectionMgr->AddIObject(aPathActor->getIO());
SALOME_ListIO aList;
aList.Append(aPathActor->getIO());
mySelectionMgr->setSelectedObjects(aList, false);
if (bOk) {
const SMDS_MeshNode* n = aMesh->FindNode(ind);
if (n) {
- //if (!mySelectionMgr->IsIndexSelected(aPathActor->getIO(), n->GetID())) {
TColStd_MapOfInteger newIndices;
newIndices.Add(n->GetID());
mySelector->AddOrRemoveIndex( aPathActor->getIO(), newIndices, false );
}
}
}
+ CheckIsEnable();
+ onDisplaySimulation(true);
}
//=================================================================================
// set busy flag
SetBusy sb (this);
- if (myEditCurrentArgument == ElementsLineEdit) {
- // we are now selecting mesh elements (or whole mesh/submesh/group)
- // reset
- ElementsLineEdit->clear();
- myMesh = SMESH::SMESH_Mesh::_nil();
- myIDSource = SMESH::SMESH_IDSource::_nil();
- myMeshActor = 0;
+ const bool isPathDef = ( SelectPathMeshButton->isChecked() ||
+ SelectStartPointButton->isChecked() );
- // try to get mesh from selection
- Handle(SALOME_InteractiveObject) IO = aList.First();
- myMesh = SMESH::GetMeshByIO(IO);
- if (myMesh->_is_nil())
- return;
-
- // MakeGroups is available if there are groups
- if ( myMesh->NbGroups() == 0 ) {
- MakeGroupsCheck->setChecked(false);
- MakeGroupsCheck->setEnabled(false);
- } else {
- MakeGroupsCheck->setEnabled(true);
- }
- // find actor
- myMeshActor = SMESH::FindActorByObject(myMesh);
- if (!myMeshActor && !MeshCheck->isChecked())
- return;
-
- if (MeshCheck->isChecked()) {
- // If "Select whole mesh, submesh or group" check box is on ->
- // get ID source and put it's name to the edit box
- QString aString;
- SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
-
- myIDSource = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
- ElementsLineEdit->setText(aString);
- } else {
- // If "Select whole mesh, submesh or group" check box is off ->
- // try to get selected elements IDs
- QString aString;
- //int aNbUnits = SMESH::GetNameOfSelectedElements(mySelectionMgr, aString);
- SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
- ElementsLineEdit->setText(aString);
- }
- }
- else if (myEditCurrentArgument == PathMeshLineEdit) {
+ if (myEditCurrentArgument == PathMeshLineEdit && isPathDef)
+ {
// we are now selecting path mesh
// reset
PathMeshLineEdit->clear();
myPath = SMESH::SMESH_IDSource::_nil();
StartPointLineEdit->clear();
-
+
// try to get mesh from selection
Handle(SALOME_InteractiveObject) IO = aList.First();
myPath = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
if( myPath->_is_nil() )
return;
-
+
QString aString;
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
PathMeshLineEdit->setText(aString);
}
- else if (myEditCurrentArgument == StartPointLineEdit) {
+ else if (myEditCurrentArgument == StartPointLineEdit && isPathDef )
+ {
// we are now selecting start point of path
// reset
StartPointLineEdit->clear();
SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPath);
if ( !aPathActor )
return;
-
+
QString aString;
int aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aPathActor->getIO(), aString);
if (aNbUnits == 1)
StartPointLineEdit->setText(aString.trimmed());
-
- } else if (myEditCurrentArgument == XSpin) {
+ }
+ else if ( myEditCurrentArgument == XSpin &&
+ SelectBasePointButton->isChecked() )
+ {
// we are now selecting base point
// reset is not performed here!
YSpin->SetValue(n->Y());
ZSpin->SetValue(n->Z());
}
+ else
+ {
+ return;
+ }
+
onDisplaySimulation(true);
+ CheckIsEnable();
}
//=================================================================================
//=================================================================================
void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument()
{
- QToolButton* send = (QToolButton*)sender();
+ QPushButton* send = (QPushButton*)sender();
if ( sender() == BasePointGrp )
send = SelectBasePointButton;
- if (send != SelectElementsButton &&
- send != SelectPathMeshButton &&
+ if (send != SelectPathMeshButton &&
send != SelectStartPointButton &&
send != SelectBasePointButton)
return;
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
-void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button)
+void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QPushButton* button)
{
disconnect(mySelectionMgr, 0, this, 0);
// mySelectionMgr->clearSelected();
mySelectionMgr->clearFilters();
SMESH::SetPickable();
- if (button == SelectElementsButton) {
- myEditCurrentArgument = ElementsLineEdit;
- SMESH::SetPointRepresentation(false);
- if (MeshCheck->isChecked()) {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(ActorSelection);
- mySelectionMgr->installFilter(myElementsFilter);
- } else {
- if (Elements1dRB->isChecked())
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
- }
- else if (Elements2dRB->isChecked())
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- }
- }
- } else if (button == SelectPathMeshButton) {
+ myEditCurrentArgument = 0;
+ if (button == SelectPathMeshButton)
+ {
myEditCurrentArgument = PathMeshLineEdit;
SMESH::SetPointRepresentation(false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(myPathMeshFilter);
}
- else if (button == SelectStartPointButton) {
+ else if (button == SelectStartPointButton)
+ {
myEditCurrentArgument = StartPointLineEdit;
- //if (!myPathMesh->_is_nil()) {
if (!myPath->_is_nil()) {
SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPath);
if (aPathActor) {
}
}
}
- else if (button == SelectBasePointButton) {
+ else if (button == SelectBasePointButton)
+ {
myEditCurrentArgument = XSpin;
SMESH::SetPointRepresentation(true);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
//=================================================================================
void SMESHGUI_ExtrusionAlongPathDlg::DeactivateActiveDialog()
{
- if (ConstructorsBox->isEnabled()) {
- ConstructorsBox->setEnabled(false);
+ if (GroupButtons->isEnabled())
+ {
GroupArguments->setEnabled(false);
GroupButtons->setEnabled(false);
+ SelectorWdg->setEnabled(false);
mySMESHGUI->ResetState();
mySMESHGUI->SetActiveDialogBox(0);
}
{
// Emit a signal to deactivate the active dialog
mySMESHGUI->EmitSignalDeactivateDialog();
- ConstructorsBox->setEnabled(true);
GroupArguments->setEnabled(true);
GroupButtons->setEnabled(true);
+ SelectorWdg->setEnabled(true);
mySMESHGUI->SetActiveDialogBox(this);
-
- ConstructorsClicked(GetConstructorId());
SelectionIntoArgument();
}
//=================================================================================
void SMESHGUI_ExtrusionAlongPathDlg::enterEvent (QEvent*)
{
- if (!ConstructorsBox->isEnabled())
+ if (!GroupButtons->isEnabled())
ActivateThisDialog();
}
-//=======================================================================
-// function : onSelectMesh()
-// purpose :
-//=======================================================================
-void SMESHGUI_ExtrusionAlongPathDlg::onSelectMesh()
-{
- bool toSelectMesh = MeshCheck->isChecked();
-
- ElementsLineEdit->setReadOnly(toSelectMesh);
- ElementsLineEdit->setValidator(toSelectMesh ? 0 : myIdValidator);
- ElementsLab->setText(toSelectMesh ? tr("SMESH_NAME") : tr("SMESH_ID_ELEMENTS"));
- ElementsLineEdit->clear();
- myFilterBtn->setEnabled(!toSelectMesh);
-
- SetEditCurrentArgument(SelectElementsButton);
-}
-
-//=================================================================================
-// function : GetConstructorId()
-// purpose :
-//=================================================================================
-int SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId()
-{
- return GroupConstructors->checkedId();
-}
-
//=======================================================================
// function : OnAngleAdded()
// purpose : Called when user adds angle to the list
}
}
else if (event->type() == QEvent::FocusIn) {
- if (object == ElementsLineEdit) {
- if (myEditCurrentArgument != ElementsLineEdit)
- SetEditCurrentArgument(SelectElementsButton);
- }
- else if (object == StartPointLineEdit) {
+ if (object == StartPointLineEdit) {
if (myEditCurrentArgument != StartPointLineEdit)
SetEditCurrentArgument(SelectStartPointButton);
}
}
}
-//=================================================================================
-// function : setFilters()
-// purpose : SLOT. Called when "Filter" button pressed.
-//=================================================================================
-void SMESHGUI_ExtrusionAlongPathDlg::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( Elements1dRB->isChecked() ? SMESH::EDGE : SMESH::FACE );
-
- myFilterDlg->SetSelection();
- myFilterDlg->SetMesh( myMesh );
- myFilterDlg->SetSourceWg( ElementsLineEdit );
-
- myFilterDlg->show();
-}
-
//=================================================================================
// function : isValid
// purpose :
// function : isValuesValid()
// purpose : Return true in case if values entered into dialog are valid
//=================================================================================
-bool SMESHGUI_ExtrusionAlongPathDlg::isValuesValid() {
-
- if ( (MeshCheck->isChecked() && myIDSource->_is_nil()) ||
- myMesh->_is_nil() ||
- myPath->_is_nil() )
+
+bool SMESHGUI_ExtrusionAlongPathDlg::isValuesValid()
+{
+ if ( myPath->_is_nil() )
return false;
- if(!MeshCheck->isChecked()) {
- QStringList aListElementsId = ElementsLineEdit->text().split(" ", QString::SkipEmptyParts);
- if(aListElementsId.count() <= 0)
- return false;
- }
-
bool bOk;
- StartPointLineEdit->text().toLong(&bOk);
- if (!bOk) {
+ long aNodeStart = StartPointLineEdit->text().toLong(&bOk);
+ if ( !bOk || aNodeStart < 1 )
+ return false;
+
+ SMESH::SMESH_Mesh_var mesh = myPath->GetMesh();
+ if ( mesh->_is_nil() )
+ return false;
+
+ SMESH::ElementType type = mesh->GetElementType( aNodeStart, false );
+ if ( type != SMESH::NODE )
+ return false;
+
+ SMESH::long_array_var elems = mesh->GetNodeInverseElements( aNodeStart );
+ if ( elems->length() != 1 ||
+ mesh->GetElementType( elems[0], true ) != SMESH::EDGE )
return false;
- }
return true;
}
-
//=================================================================================
// function : onDisplaySimulation
// purpose : Show/Hide preview
//=================================================================================
-void SMESHGUI_ExtrusionAlongPathDlg::onDisplaySimulation( bool toDisplayPreview ) {
- if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
- if(isValid() && isValuesValid()) {
-
- //Get selected elements:
- SMESH::long_array_var anElementsId = getSelectedElements();
+void SMESHGUI_ExtrusionAlongPathDlg::onDisplaySimulation( bool toDisplayPreview )
+{
+ if ( myPreviewCheckBox->isChecked() && toDisplayPreview ) {
+ if ( SelectorWdg->IsAnythingSelected() && isValid() && isValuesValid())
+ {
// get angles
SMESH::double_array_var anAngles = getAngles();
bool bOk;
long aNodeStart = StartPointLineEdit->text().toLong(&bOk);
if (bOk) {
-
+
try {
SUIT_OverrideCursor wc;
-
+
SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
- SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
- bool NeedGroups = false;
- SMESH::ElementType ElemType = ( GetConstructorId() == 0 ) ? SMESH::EDGE : SMESH::FACE;
- if( !MeshCheck->isChecked() ) {
- aMeshEditor->ExtrusionAlongPathX(anElementsId, myPath, aNodeStart, AnglesGrp->isChecked(),
- anAngles, LinearAnglesCheck->isChecked(),
- BasePointGrp->isChecked(), aBasePoint,
- NeedGroups, ElemType, retVal);
+ SMESH::SMESH_Mesh_var mesh = SelectorWdg->GetMesh();
+ SMESH::SMESH_MeshEditor_var meshEditor = mesh->GetMeshEditPreviewer();
+
+ 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;
+
+ SMESH::ListOfGroups_var groups =
+ meshEditor->ExtrusionAlongPathObjects( nodes, edges, faces, myPath,
+ GEOM::GEOM_Object::_nil(),
+ aNodeStart, AnglesGrp->isChecked(),
+ anAngles, LinearAnglesCheck->isChecked(),
+ BasePointGrp->isChecked(), aBasePoint,
+ makeGroups, retVal );
+
+ if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK )
+ {
+ SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData();
+ mySimulation->SetData( aMeshPreviewStruct._retn() );
}
else {
- SMESH::ListOfGroups_var groups =
- aMeshEditor->ExtrusionAlongPathObjX(myIDSource, myPath, aNodeStart, AnglesGrp->isChecked(),
- anAngles, LinearAnglesCheck->isChecked(),
- BasePointGrp->isChecked(), aBasePoint,
- NeedGroups, ElemType, retVal);
- }
-
- if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK ) {
- SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
- mySimulation->SetData(aMeshPreviewStruct._retn());
- } else {
hidePreview();
}
-
+
} catch (...) {
hidePreview();
}
} else {
hidePreview();
}
-
+
} else {
hidePreview();
}
}
}
-
-//=================================================================================
-// function : getSelectedElements
-// purpose : return list of the selected elements
-//=================================================================================
-SMESH::long_array_var SMESHGUI_ExtrusionAlongPathDlg::getSelectedElements() {
-
- // If "Select whole mesh, submesh or group" check box is off ->
- // use only elements of given type selected by user
- SMESH::long_array_var anElementsId = new SMESH::long_array;
- if (!MeshCheck->isChecked()) {
-
- SMDS_Mesh* aMesh;
- if ( myMeshActor )
- aMesh = myMeshActor->GetObject()->GetMesh();
-
- if (aMesh) {
- QStringList aListElementsId = ElementsLineEdit->text().split(" ", QString::SkipEmptyParts);
- anElementsId = new SMESH::long_array;
- anElementsId->length(aListElementsId.count());
- bool bOk;
- int j = 0;
- for (int i = 0; i < aListElementsId.count(); i++) {
- long ind = aListElementsId[ i ].toLong(&bOk);
- if (bOk) {
- const SMDS_MeshElement* e = aMesh->FindElement(ind);
- if (e) {
- bool typeMatch = (Elements1dRB->isChecked() && e->GetType() == SMDSAbs_Edge) ||
- (Elements2dRB->isChecked() && e->GetType() == SMDSAbs_Face);
- if (typeMatch)
- anElementsId[ j++ ] = ind;
- }
- }
- }
- anElementsId->length(j);
- }
- }
- return anElementsId;
-}
-
-SMESH::double_array_var SMESHGUI_ExtrusionAlongPathDlg::getAngles() {
+SMESH::double_array_var SMESHGUI_ExtrusionAlongPathDlg::getAngles()
+{
SMESH::double_array_var anAngles = new SMESH::double_array;
- if (AnglesGrp->isChecked()) {
+ if (AnglesGrp->isChecked())
+ {
anAngles->length(myAnglesList.count());
int j = 0;
for (int i = 0; i < myAnglesList.count(); i++) {
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
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();
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;
QToolButton* RemoveAngleButton;
SMESHGUI_SpinBox* AngleSpin;
QGroupBox* BasePointGrp;
- QToolButton* SelectBasePointButton;
+ QPushButton* SelectBasePointButton;
SMESHGUI_SpinBox* XSpin;
SMESHGUI_SpinBox* YSpin;
SMESHGUI_SpinBox* ZSpin;
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
#define SPACING 6
#define MARGIN 11
+namespace
+{
+ const char* getLabelText( int typeIndex, bool objSelection )
+ {
+ const char* typeLbl[3] = { "SMESH_ID_NODES", "SMESH_ID_EDGES", "SMESH_ID_FACES" };
+ const char* obj = "SMESH_OBJECTS";
+ return objSelection ? obj : typeLbl[ typeIndex ];
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Constructor
+ */
+//================================================================================
+
+SMESHGUI_3TypesSelector::SMESHGUI_3TypesSelector( QWidget * parent ):
+ QWidget( parent )
+{
+ SMESHGUI* gui = SMESHGUI::GetSMESHGUI();
+ mySelectionMgr = SMESH::GetSelectionMgr( gui );
+ mySelector = SMESH::GetViewWindow( gui )->GetSelector();
+ myFilterDlg = 0;
+ myIdValidator = new SMESHGUI_IdValidator(this);
+
+ QPixmap image( SMESH::GetResourceMgr( gui )->loadPixmap("SMESH", tr("ICON_SELECT")));
+
+ mySelectBtnGrp = new QButtonGroup( this );
+ mySelectBtnGrp->setExclusive( true );
+
+ QVBoxLayout* mainLayout = new QVBoxLayout( this );
+ mainLayout->setSpacing( SPACING );
+ mainLayout->setMargin( 0 );
+
+ const char* groupLbl[3] = { "SMESH_NODES", "SMESH_EDGES", "SMESH_FACES" };
+
+ for ( int i = 0; i < 3; ++i )
+ {
+ myGroups[i] = new QGroupBox( tr( groupLbl[i] ), this );
+ mainLayout->addWidget( myGroups[i] );
+ QGridLayout* layout = new QGridLayout( myGroups[i] );
+ layout->setSpacing( SPACING );
+ layout->setMargin( MARGIN );
+
+ QPushButton* selBtn = new QPushButton( myGroups[i] );
+ selBtn->setIcon( image );
+ selBtn->setCheckable( true );
+ mySelectBtnGrp->addButton( selBtn, i );
+ myLabel [i] = new QLabel( myGroups[i] );
+ myLineEdit [i] = new QLineEdit( myGroups[i] );
+ myMeshChk [i] = new QCheckBox( tr("SMESH_SELECT_WHOLE_MESH"), myGroups[i] );
+ myFilterBtn[i] = new QPushButton( tr( "SMESH_BUT_FILTER" ), myGroups[i] );
+
+ myLineEdit[i]->setMaxLength(-1);
+ myLabel [i]->setText( tr( getLabelText( i, true )));
+
+ layout->addWidget(myLabel [i], 0, 0);
+ layout->addWidget(selBtn, 0, 1);
+ layout->addWidget(myLineEdit [i], 0, 2, 1, 2);
+ layout->addWidget(myFilterBtn[i], 0, 4);
+ layout->addWidget(myMeshChk [i], 1, 0, 1, 5);
+ layout->setColumnStretch( 2, 10 );
+
+ connect( myMeshChk [i], SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
+ connect( myFilterBtn[i], SIGNAL(clicked()), SLOT(setFilters()));
+ connect( myLineEdit [i], SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
+ myIDSource[i] = new SMESH::ListOfIDSources;
+ }
+ connect( mySelectBtnGrp, SIGNAL(buttonClicked (int)), SLOT(onSelectType(int)));
+ connect(mySelectionMgr, SIGNAL( currentSelectionChanged()), SLOT(selectionIntoArgument()));
+
+ // Costruction of the logical filter for the elements: mesh/sub-mesh/group
+ QList<SUIT_SelectionFilter*> aListOfFilters;
+ aListOfFilters.append(new SMESH_TypeFilter (SMESH::MESH));
+ aListOfFilters.append(new SMESH_TypeFilter (SMESH::SUBMESH_VERTEX));
+ aListOfFilters.append(new SMESH_TypeFilter (SMESH::GROUP_NODE));
+ myFilter[0] =
+ new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
+ aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH);
+ aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_EDGE);
+ aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_EDGE);
+ myFilter[1] =
+ new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
+ aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH);
+ aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_FACE);
+ aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_FACE);
+ myFilter[2] =
+ new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
+
+ myBusy = false;
+
+ myMeshChk[0]->setChecked( true );
+ myMeshChk[1]->setChecked( true );
+ myMeshChk[2]->setChecked( true );
+ mySelectBtnGrp->button(0)->click();
+}
+
+//================================================================================
+/*!
+ * \brief Destructor
+ */
+//================================================================================
+
+SMESHGUI_3TypesSelector::~SMESHGUI_3TypesSelector()
+{
+ myIDSource[0].out();
+ myIDSource[1].out();
+ myIDSource[2].out();
+
+ delete myFilter[0];
+ delete myFilter[1];
+ delete myFilter[2];
+
+ if ( myFilterDlg )
+ {
+ myFilterDlg->setParent( 0 );
+ delete myFilterDlg;
+ myFilterDlg = 0;
+ }
+ disconnect(mySelectionMgr, 0, this, 0);
+}
+
+//================================================================================
+/*!
+ * \brief Slot called when selection changes
+ */
+//================================================================================
+
+void SMESHGUI_3TypesSelector::selectionIntoArgument()
+{
+ if (myBusy) return;
+
+ // return if dialog box is inactive
+ if ( !isEnabled() )
+ return;
+
+ // get a current element type
+ int iType = mySelectBtnGrp->checkedId();
+ if ( iType < 0 || iType > 2 )
+ return;
+
+ QString aString = "";
+ int nbObjects = 0;
+
+ // clear
+ myBusy = true;
+ myLineEdit[ iType ]->setText(aString);
+ myIDSource[ iType ]->length (nbObjects);
+ myBusy = false;
+ if ( !myGroups[ iType ]->isEnabled() )
+ return;
+
+ SMESH::SetPointRepresentation(false);
+
+ SALOME_ListIO selected;
+ mySelectionMgr->selectedObjects( selected );
+
+ if ( myMeshChk[ iType ]->isChecked() ) // objects selection
+ myIDSource[ iType ]->length( selected.Extent() ); // reserve
+ myIDSource[ iType ]->length(0);
+
+ SALOME_ListIteratorOfListIO It( selected );
+ for ( ; It.More(); It.Next() )
+ {
+ Handle(SALOME_InteractiveObject) IO = It.Value();
+
+ // get selected mesh
+ SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(IO);
+ if ( mesh->_is_nil() )
+ continue;
+ if ( !myMesh->_is_nil() &&
+ IsAnythingSelected() &&
+ myMesh->GetId() != mesh->GetId() )
+ continue; // other mesh
+ myMesh = mesh;
+ myIO = IO;
+ myActor = SMESH::FindActorByEntry( IO->getEntry() );
+
+ if ( myMeshChk[ iType ]->isChecked() ) // objects selection
+ {
+ SMESH::SMESH_IDSource_var idSrc = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
+ if ( idSrc->_is_nil() )
+ continue;
+ mesh = SMESH::SMESH_Mesh::_narrow( idSrc );
+ if ( !mesh->_is_nil() ) // if a mesh is selected, stop iteration
+ {
+ nbObjects = 1;
+ myIDSource[ iType ]->length( nbObjects );
+ myIDSource[ iType ][ 0 ] = idSrc;
+ aString = IO->getName();
+ break;
+ }
+ else // several groups can be selected
+ {
+ myIDSource[ iType ]->length( nbObjects + 1 );
+ myIDSource[ iType ][ nbObjects++ ] = idSrc;
+ aString += " " + QString( IO->getName() ) + " ";
+ }
+ }
+ else // get indices of selected elements
+ {
+ TColStd_IndexedMapOfInteger aMapIndex;
+ mySelector->GetIndex(IO,aMapIndex);
+ int nbElements = aMapIndex.Extent();
+ if ( nbElements > 0 )
+ {
+ SMESH::long_array_var ids = new SMESH::long_array;
+ ids->length( nbElements );
+ for ( int i = 0; i < nbElements; ++i )
+ aString += QString(" %1").arg( ids[ i ] = aMapIndex( i+1 ));
+ addTmpIdSource( ids, iType, nbObjects++ );
+ }
+ break;
+ }
+ }
+
+ myIDSource[ iType ]->length( nbObjects );
+
+ myBusy = true;
+ myLineEdit[ iType ]->setText(aString);
+ myBusy = false;
+
+ emit selectionChanged();
+}
+
+//================================================================================
+/*!
+ * \brief Slot called when text changes in myLineEdit
+ */
+//================================================================================
+
+void SMESHGUI_3TypesSelector::onTextChange( const QString& theNewText )
+{
+ // return if busy
+ if (myBusy) return;
+
+ // get a current element type
+ int iType = 0;
+ QLineEdit* le = (QLineEdit*) sender();
+ for ( ; iType < 3; ++iType )
+ if ( myLineEdit[ iType ] == le )
+ break;
+ if ( iType < 0 || iType > 2 )
+ return;
+ if ( !myGroups[ iType ]->isEnabled() )
+ return;
+
+ myBusy = true;
+
+ // hilight entered elements/nodes
+
+ myIDSource[ iType ]->length( 0 );
+
+ if ( !myMesh->_is_nil() )
+ {
+ QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
+ if ( aListId.count() > 0 )
+ {
+ SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
+
+ SMESH::ElementType SMESHType = SMESH::ElementType ( iType+1 );
+ SMDSAbs_ElementType SMDSType = SMDSAbs_ElementType( iType+1 );
+ const bool isNode = ( SMDSType == SMDSAbs_Node );
+
+ SMESH::long_array_var ids = new SMESH::long_array;
+ ids->length( aListId.count() );
+ TColStd_MapOfInteger newIndices;
+ for (int i = 0; i < aListId.count(); i++) {
+ int id = aListId[ i ].toInt();
+ bool validId = false;
+ if ( id > 0 ) {
+ if ( aMesh ) {
+ const SMDS_MeshElement * e;
+ if ( isNode ) e = aMesh->FindNode( id );
+ else e = aMesh->FindElement( id );
+ validId = ( e && e->GetType() == SMDSType );
+ } else {
+ validId = ( myMesh->GetElementType( id, !isNode ) == SMESHType );
+ }
+ }
+ if ( validId && newIndices.Add( id ))
+ ids[ newIndices.Extent()-1 ] = id;
+ }
+ if ( !newIndices.IsEmpty() ) {
+ ids->length( newIndices.Extent() );
+ addTmpIdSource( ids, iType, 0 );
+ }
+ mySelector->AddOrRemoveIndex(myIO, newIndices, false);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView() )
+ aViewWindow->highlight( myIO, true, true );
+ }
+ }
+
+ emit selectionChanged();
+
+ myBusy = false;
+}
+
+//================================================================================
+/*!
+ * \brief Creates from ids and stores a temporary IDSource
+ */
+//================================================================================
+
+void SMESHGUI_3TypesSelector::addTmpIdSource( SMESH::long_array_var& ids, int iType, int index )
+{
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ SMESH::SMESH_IDSource_var idSrc =
+ aMeshEditor->MakeIDSource( ids, SMESH::ElementType( iType+1 ));
+
+ if ( myIDSource[ iType ]->length() <= index )
+ myIDSource[ iType ]->length( index + 1 );
+ myIDSource[ iType ][ index ] = idSrc;
+
+ myTmpIDSourceList.push_back( idSrc );
+}
+
+//================================================================================
+/*!
+ * \brief Slot called when myMeshChk is checked
+ */
+//================================================================================
+
+void SMESHGUI_3TypesSelector::onSelectMesh( bool on )
+{
+ QCheckBox* send = (QCheckBox*)sender();
+ for ( int iType = 0; iType < 3; ++iType )
+ if ( send == myMeshChk[ iType ])
+ {
+ myLabel[ iType ]->setText( tr( getLabelText( iType, on )));
+ myFilterBtn[ iType ]->setEnabled( !on );
+ myIDSource [ iType ]->length(0);
+ myBusy = true;
+ myLineEdit [ iType ]->setText("");
+ myBusy = false;
+ myLineEdit [ iType ]->setReadOnly( on );
+ myLineEdit [ iType ]->setValidator( on ? 0 : myIdValidator );
+ mySelectBtnGrp->button(iType)->click();
+ break;
+ }
+ else
+ {
+
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Slot called when a selection button is clicked
+ */
+//================================================================================
+
+void SMESHGUI_3TypesSelector::onSelectType(int iType)
+{
+ if ( iType < 0 || iType > 2 )
+ return;
+
+ myIDSource[ iType ]->length(0);
+ myLineEdit[ iType ]->setText("");
+
+ disconnect(mySelectionMgr, 0, this, 0);
+ mySelectionMgr->clearFilters();
+
+ SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
+ if ( myMeshChk[ iType ]->isChecked() )
+ {
+ if ( aViewWindow ) aViewWindow->SetSelectionMode(ActorSelection);
+ mySelectionMgr->installFilter( myFilter[ iType ]);
+ }
+ else if ( aViewWindow )
+ {
+ switch ( iType+1 ) {
+ case SMESH::NODE: aViewWindow->SetSelectionMode(NodeSelection); break;
+ case SMESH::EDGE: aViewWindow->SetSelectionMode(EdgeSelection); break;
+ case SMESH::FACE: aViewWindow->SetSelectionMode(FaceSelection); break;
+ }
+ }
+
+ myLineEdit[ iType ]->setFocus();
+
+ connect(mySelectionMgr, SIGNAL( currentSelectionChanged()), SLOT( selectionIntoArgument()));
+ selectionIntoArgument();
+}
+
+//================================================================================
+/*!
+ * \brief Slot called when "Set filter" is clicked
+ */
+//================================================================================
+
+void SMESHGUI_3TypesSelector::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::NODE );
+ types.append( SMESH::EDGE );
+ types.append( SMESH::FACE );
+ myFilterDlg = new SMESHGUI_FilterDlg( SMESHGUI::GetSMESHGUI(), types );
+ }
+
+ QPushButton* send = (QPushButton*)sender();
+ for ( int iType = 0; iType < 3; ++iType )
+ if ( send == myFilterBtn[ iType ])
+ {
+ mySelectBtnGrp->button(iType)->click();
+
+ myFilterDlg->Init( SMESH::ElementType( iType+1 ) );
+ myFilterDlg->SetSelection();
+ myFilterDlg->SetMesh( myMesh );
+ myFilterDlg->SetSourceWg( myLineEdit[ iType ]);
+ myFilterDlg->show();
+ break;
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Clear selection
+ */
+//================================================================================
+
+void SMESHGUI_3TypesSelector::Clear()
+{
+ myBusy = true;
+ for ( int iType = 0; iType < 3; ++iType )
+ {
+ myIDSource[ iType ]->length(0);
+ myLineEdit[ iType ]->setText("");
+ }
+ myBusy = false;
+ selectionIntoArgument();
+}
+
+//================================================================================
+/*!
+ * \brief Enable/disable controls of a type
+ */
+//================================================================================
+
+void SMESHGUI_3TypesSelector::SetEnabled( bool enable, SMESH::ElementType type )
+{
+ myBusy = true;
+ for ( int iType = 0; iType < 3; ++iType )
+ if ( iType+1 == type || type == SMESH::ALL )
+ {
+ myGroups[ iType ]->setEnabled( enable );
+ if ( !enable ) {
+ myIDSource[ iType ]->length(0);
+ myLineEdit[ iType ]->setText("");
+ }
+ }
+ myBusy = false;
+ selectionIntoArgument();
+}
+
+//================================================================================
+/*!
+ * \brief Checks if anything is selected
+ */
+//================================================================================
+
+bool SMESHGUI_3TypesSelector::IsAnythingSelected( SMESH::ElementType type )
+{
+ int nbSel = 0;
+
+ for ( int iType = 0; iType < 3; ++iType )
+ if ( iType+1 == type || type == SMESH::ALL )
+ nbSel += myIDSource[ iType ]->length();
+
+ return nbSel;
+}
+
+//================================================================================
+/*!
+ * \brief Returns selected elements and most complex type of selected elements
+ */
+//================================================================================
+
+SMESH::ElementType SMESHGUI_3TypesSelector::GetSelected( SMESH::ListOfIDSources & nodes,
+ SMESH::ListOfIDSources & edges,
+ SMESH::ListOfIDSources & faces )
+{
+ nodes = myIDSource[0];
+ edges = myIDSource[1];
+ faces = myIDSource[2];
+
+ if ( myIDSource[2]->length() > 0 ) return SMESH::FACE;
+ if ( myIDSource[1]->length() > 0 ) return SMESH::EDGE;
+ if ( myIDSource[0]->length() > 0 ) return SMESH::NODE;
+ return SMESH::ALL;
+}
+
//=================================================================================
// function : SMESHGUI_ExtrusionDlg()
// purpose : constructor
//=================================================================================
+
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
: SMESHGUI_PreviewDlg( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myEditCurrentArgument(0),
- myFilterDlg( 0 ),
- mySelectedObject(SMESH::SMESH_IDSource::_nil())
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
- QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
- QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
- QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
- QPixmap image3 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_NODE")));
+ QPixmap image (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
SMESHGUI_ExtrusionDlgLayout->setMargin(MARGIN);
/***************************************************************/
- ConstructorsBox = new QGroupBox(tr("SMESH_EXTRUSION"), this);
- GroupConstructors = new QButtonGroup(this);
- QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
- ConstructorsBoxLayout->setSpacing(SPACING);
- ConstructorsBoxLayout->setMargin(MARGIN);
-
- Contructor_RBut0= new QRadioButton(ConstructorsBox);
- Contructor_RBut0->setIcon(image3);
- Contructor_RBut1= new QRadioButton(ConstructorsBox);
- Contructor_RBut1->setIcon(image0);
- Contructor_RBut2= new QRadioButton(ConstructorsBox);
- Contructor_RBut2->setIcon(image1);
-
- ConstructorsBoxLayout->addWidget(Contructor_RBut0);
- ConstructorsBoxLayout->addWidget(Contructor_RBut1);
- ConstructorsBoxLayout->addWidget(Contructor_RBut2);
-
- GroupConstructors->addButton(Contructor_RBut0, 0);
- GroupConstructors->addButton(Contructor_RBut1, 1);
- GroupConstructors->addButton(Contructor_RBut2, 2);
-
- /***************************************************************/
- GroupButtons = new QGroupBox(this);
- QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
- GroupButtonsLayout->setSpacing(SPACING);
- GroupButtonsLayout->setMargin(MARGIN);
-
- buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
- buttonOk->setAutoDefault(true);
- buttonOk->setDefault(true);
- buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
- buttonApply->setAutoDefault(true);
- buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
- buttonCancel->setAutoDefault(true);
- buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
- buttonHelp->setAutoDefault(true);
-
- GroupButtonsLayout->addWidget(buttonOk);
- GroupButtonsLayout->addSpacing(10);
- GroupButtonsLayout->addWidget(buttonApply);
- GroupButtonsLayout->addSpacing(10);
- GroupButtonsLayout->addStretch();
- GroupButtonsLayout->addWidget(buttonCancel);
- GroupButtonsLayout->addWidget(buttonHelp);
-
- /***************************************************************/
- GroupArguments = new QGroupBox(tr("EXTRUSION_0D"), this);
+ GroupArguments = new QGroupBox(tr("SMESH_EXTRUSION"), 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 );
ExtrMethod_RBut0 = new QRadioButton(GroupArguments);
ExtrMethod_RBut0->setText( tr("SMESH_EXTRUSION_TO_DISTANCE") );
TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupArguments);
SelectVectorButton = new QPushButton(GroupArguments);
- SelectVectorButton->setIcon(image2);
+ SelectVectorButton->setIcon(image);
+ SelectVectorButton->setCheckable( true );
+ SelectorWdg->GetButtonGroup()->addButton( SelectVectorButton );
TextLabelVx = new QLabel(tr("SMESH_DX"), GroupArguments);
SpinBox_Vx = new SMESHGUI_SpinBox(GroupArguments);
//Preview check box
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
- GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
- GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
- GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 5);
- GroupArgumentsLayout->addWidget(myFilterBtn, 0, 7);
- GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 8);
- GroupArgumentsLayout->addWidget(ExtrMethod_RBut0, 2, 0, 1, 3);
- GroupArgumentsLayout->addWidget(ExtrMethod_RBut1, 2, 3, 1, 3);
- GroupArgumentsLayout->addWidget(ExtrMethod_RBut2, 2, 6, 1, 3);
- GroupArgumentsLayout->addWidget(TextLabelDistance, 3, 0);
- GroupArgumentsLayout->addWidget(TextLabelDx, 3, 2);
- GroupArgumentsLayout->addWidget(SpinBox_Dx, 3, 3);
- GroupArgumentsLayout->addWidget(TextLabelDy, 3, 4);
- GroupArgumentsLayout->addWidget(SpinBox_Dy, 3, 5);
- GroupArgumentsLayout->addWidget(TextLabelDz, 3, 6);
- GroupArgumentsLayout->addWidget(SpinBox_Dz, 3, 7);
- GroupArgumentsLayout->addWidget(TextLabelVector, 4, 0);
- GroupArgumentsLayout->addWidget(SelectVectorButton, 4, 1);
- GroupArgumentsLayout->addWidget(TextLabelVx, 4, 2);
- GroupArgumentsLayout->addWidget(SpinBox_Vx, 4, 3);
- GroupArgumentsLayout->addWidget(TextLabelVy, 4, 4);
- GroupArgumentsLayout->addWidget(SpinBox_Vy, 4, 5);
- GroupArgumentsLayout->addWidget(TextLabelVz, 4, 6);
- GroupArgumentsLayout->addWidget(SpinBox_Vz, 4, 7);
- GroupArgumentsLayout->addWidget(TextLabelDist, 5, 0);
- GroupArgumentsLayout->addWidget(SpinBox_VDist, 5, 3);
- GroupArgumentsLayout->addWidget(TextLabelNbSteps, 6, 0, 1, 3);
- GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 6, 3);
- GroupArgumentsLayout->addWidget(ByAverageNormalCheck, 7, 0, 1, 4);
- GroupArgumentsLayout->addWidget(UseInputElemsOnlyCheck, 7, 4, 1, 4);
- GroupArgumentsLayout->addWidget(myPreviewCheckBox, 8, 0, 1, 8);
- GroupArgumentsLayout->addWidget(MakeGroupsCheck, 9, 0, 1, 8);
+ GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0, 1, 9);
+ GroupArgumentsLayout->addWidget(ExtrMethod_RBut0, 1, 0, 1, 3);
+ GroupArgumentsLayout->addWidget(ExtrMethod_RBut1, 1, 3, 1, 3);
+ GroupArgumentsLayout->addWidget(ExtrMethod_RBut2, 1, 6, 1, 3);
+ GroupArgumentsLayout->addWidget(TextLabelDistance, 2, 0);
+ GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
+ GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3);
+ GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4);
+ GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5);
+ GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6);
+ GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7);
+ GroupArgumentsLayout->addWidget(TextLabelVector, 3, 0);
+ GroupArgumentsLayout->addWidget(SelectVectorButton, 3, 1);
+ GroupArgumentsLayout->addWidget(TextLabelVx, 3, 2);
+ GroupArgumentsLayout->addWidget(SpinBox_Vx, 3, 3);
+ GroupArgumentsLayout->addWidget(TextLabelVy, 3, 4);
+ GroupArgumentsLayout->addWidget(SpinBox_Vy, 3, 5);
+ GroupArgumentsLayout->addWidget(TextLabelVz, 3, 6);
+ GroupArgumentsLayout->addWidget(SpinBox_Vz, 3, 7);
+ GroupArgumentsLayout->addWidget(TextLabelDist, 4, 0);
+ GroupArgumentsLayout->addWidget(SpinBox_VDist, 4, 3);
+ GroupArgumentsLayout->addWidget(TextLabelNbSteps, 5, 0, 1, 3);
+ GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 5, 3);
+ GroupArgumentsLayout->addWidget(ByAverageNormalCheck, 6, 0, 1, 4);
+ GroupArgumentsLayout->addWidget(UseInputElemsOnlyCheck, 6, 4, 1, 4);
+ GroupArgumentsLayout->addWidget(myPreviewCheckBox, 7, 0, 1, 8);
+ GroupArgumentsLayout->addWidget(MakeGroupsCheck, 8, 0, 1, 8);
GroupArgumentsLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 10, 0);
+ /***************************************************************/
+ GroupButtons = new QGroupBox(this);
+ QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
+ GroupButtonsLayout->setSpacing(SPACING);
+ GroupButtonsLayout->setMargin(MARGIN);
+
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
+ buttonOk->setAutoDefault(true);
+ buttonOk->setDefault(true);
+ buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
+ buttonApply->setAutoDefault(true);
+ buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
+ buttonCancel->setAutoDefault(true);
+ buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
+ buttonHelp->setAutoDefault(true);
+
+ GroupButtonsLayout->addWidget(buttonOk);
+ GroupButtonsLayout->addSpacing(10);
+ GroupButtonsLayout->addWidget(buttonApply);
+ GroupButtonsLayout->addSpacing(10);
+ GroupButtonsLayout->addStretch();
+ GroupButtonsLayout->addWidget(buttonCancel);
+ GroupButtonsLayout->addWidget(buttonHelp);
/***************************************************************/
- SMESHGUI_ExtrusionDlgLayout->addWidget(ConstructorsBox);
SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments);
SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons);
SpinBox_NbSteps->setRange(1, 999999);
SpinBox_VDist->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
- Contructor_RBut0->setChecked(true);
ExtrMethod_RBut0->setChecked(true);
UseInputElemsOnlyCheck->setChecked(true);
MakeGroupsCheck->setChecked(true);
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
- mySMESHGUI->SetActiveDialogBox(this);
-
- // Costruction of the logical filter for the elements: mesh/sub-mesh/group
- QList<SUIT_SelectionFilter*> aListOfFilters;
- aListOfFilters.append(new SMESH_TypeFilter (SMESH::MESH));
- aListOfFilters.append(new SMESH_TypeFilter (SMESH::SUBMESH_VERTEX));
- aListOfFilters.append(new SMESH_TypeFilter (SMESH::GROUP_NODE));
- myMeshOrSubMeshOrGroupFilter0D =
- new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
- aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH);
- aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_EDGE);
- aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_EDGE);
- myMeshOrSubMeshOrGroupFilter1D =
- new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
- aListOfFilters[0] = new SMESH_TypeFilter (SMESH::MESH);
- aListOfFilters[1] = new SMESH_TypeFilter (SMESH::SUBMESH_FACE);
- aListOfFilters[2] = new SMESH_TypeFilter (SMESH::GROUP_FACE);
- myMeshOrSubMeshOrGroupFilter2D =
- new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR, /*takeOwnership=*/true);
+ mySMESHGUI->SetActiveDialogBox(this);
myHelpFileName = "extrusion_page.html";
connect(SpinBox_Dy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
connect(SpinBox_Dz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable()));
- connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int)));
- connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- 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(toDisplaySimulation()));
+ 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(SpinBox_Dx, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(SpinBox_Dy, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
/***************************************************************/
- ConstructorsClicked(0);
ClickOnRadio();
- SelectionIntoArgument();
}
//=================================================================================
//=================================================================================
SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
{
- if ( myFilterDlg != 0 ) {
- myFilterDlg->setParent( 0 );
- delete myFilterDlg;
- }
- if ( myMeshOrSubMeshOrGroupFilter0D ) delete myMeshOrSubMeshOrGroupFilter0D;
- if ( myMeshOrSubMeshOrGroupFilter1D ) delete myMeshOrSubMeshOrGroupFilter1D;
- if ( myMeshOrSubMeshOrGroupFilter2D ) delete myMeshOrSubMeshOrGroupFilter2D;
}
//=================================================================================
//=================================================================================
void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
{
- myBusy = false;
- myIDs.clear();
-
- LineEditElements->clear();
- myNbOkElements = 0;
-
- myActor = 0;
- myMesh = SMESH::SMESH_Mesh::_nil();
-
- if (ResetControls) {
+ if (ResetControls)
+ {
SpinBox_NbSteps->setValue(1);
SpinBox_VDist->setValue(10);
SpinBox_Dx->SetValue(0);
SpinBox_Vy->SetValue(0);
SpinBox_Vz->SetValue(0);
- CheckBoxMesh->setChecked(false);
- onSelectMesh(false);
myPreviewCheckBox->setChecked(false);
onDisplaySimulation(false);
}
-
+ SelectorWdg->Clear();
CheckIsEnable();
}
//=================================================================================
void SMESHGUI_ExtrusionDlg::CheckIsEnable()
{
- bool anIsEnable = myNbOkElements > 0 && isValuesValid();
+ bool anIsEnable = SelectorWdg->IsAnythingSelected() && isValuesValid();
buttonOk->setEnabled(anIsEnable);
buttonApply->setEnabled(anIsEnable);
// function : isValuesValid()
// purpose : Return true in case if values entered into dialog are valid
//=================================================================================
-bool SMESHGUI_ExtrusionDlg::isValuesValid() {
+bool SMESHGUI_ExtrusionDlg::isValuesValid()
+{
double aX, aY, aZ, aModule = 0;
- if ( ExtrMethod_RBut0->isChecked() ) {
+ if ( ExtrMethod_RBut0->isChecked() )
+ {
aX = SpinBox_Dx->GetValue();
aY = SpinBox_Dy->GetValue();
aZ = SpinBox_Dz->GetValue();
aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
}
- else if ( ExtrMethod_RBut1->isChecked() ) {
+ else if ( ExtrMethod_RBut1->isChecked() )
+ {
aX = SpinBox_Vx->GetValue();
aY = SpinBox_Vy->GetValue();
aZ = SpinBox_Vz->GetValue();
aModule = sqrt(aX*aX + aY*aY + aZ*aZ);
+ double aVDist = (double)SpinBox_VDist->value();
+ aModule *= aVDist;
}
- else if ( ExtrMethod_RBut2->isChecked() ) {
- aModule = 1;
+ else if ( ExtrMethod_RBut2->isChecked() )
+ {
+ aModule = (double)SpinBox_VDist->value();
}
return aModule > 1.0E-38;
}
//=================================================================================
-// function : ConstructorsClicked()
+// function : ClickOnRadio()
// purpose : Radio button management
//=================================================================================
-void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
-{
- disconnect(mySelectionMgr, 0, this, 0);
-
- hidePreview();
-
- TextLabelElements->setText(tr( constructorId ? "SMESH_ID_ELEMENTS" : "SMESH_ID_NODES"));
-
- switch (constructorId) {
- case 0:
- {
- GroupArguments->setTitle(tr("EXTRUSION_0D"));
- if (!CheckBoxMesh->isChecked())
- {
- LineEditElements->clear();
- myIDs.clear();
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(NodeSelection);
- }
- break;
- }
- case 1:
- {
- GroupArguments->setTitle(tr("EXTRUSION_1D"));
- if (!CheckBoxMesh->isChecked())
- {
- LineEditElements->clear();
- myIDs.clear();
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
- }
- break;
- }
- case 2:
- {
- GroupArguments->setTitle(tr("EXTRUSION_2D"));
- if (!CheckBoxMesh->isChecked())
- {
- LineEditElements->clear();
- myIDs.clear();
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- }
- break;
- }
- }
-
- ExtrMethod_RBut2->setVisible( constructorId == 2 );
- if ( !ExtrMethod_RBut2->isVisible() &&
- ExtrMethod_RBut2->isChecked() )
- ExtrMethod_RBut0->click();
-
- myEditCurrentArgument = (QWidget*)LineEditElements;
- LineEditElements->setFocus();
-
- if (CheckBoxMesh->isChecked())
- onSelectMesh(true);
-
- myEditCurrentArgument->hide();
- myEditCurrentArgument->show();
-
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-}
-//=================================================================================
-// function : ConstructorsClicked()
-// purpose : Radio button management
-//=================================================================================
void SMESHGUI_ExtrusionDlg::ClickOnRadio()
{
if ( ExtrMethod_RBut0->isChecked() )
ByAverageNormalCheck->hide();
UseInputElemsOnlyCheck->hide();
+
+ SelectorWdg->SetEnabled( true, SMESH::ALL );
}
else if ( ExtrMethod_RBut1->isChecked() )
{
ByAverageNormalCheck->hide();
UseInputElemsOnlyCheck->hide();
+
+ SelectorWdg->SetEnabled( true, SMESH::ALL );
}
else if ( ExtrMethod_RBut2->isChecked() )
{
ByAverageNormalCheck->show();
UseInputElemsOnlyCheck->show();
+
+ SelectorWdg->SetEnabled( false, SMESH::NODE );
+ SelectorWdg->SetEnabled( false, SMESH::EDGE );
}
CheckIsEnable();
// function : ClickOnApply()
// purpose : Called when user presses <Apply> button
//=================================================================================
+
bool SMESHGUI_ExtrusionDlg::ClickOnApply()
{
if (mySMESHGUI->isActiveStudyLocked())
if (!isValid())
return false;
- if (myNbOkElements) {
-
+ if ( SelectorWdg->IsAnythingSelected() )
+ {
SMESH::DirStruct aVector;
getExtrusionVector(aVector);
aParameters << SpinBox_NbSteps->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();
+
+ 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::EDGE + 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();
-
- myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+ SMESH::SMESH_MeshEditor_var meshEditor = mesh->GetMeshEditor();
+ SMESH::ListOfGroups_var groups;
- const bool makeGroups = MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked();
+ mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if ( ExtrMethod_RBut2->isVisible() &&
ExtrMethod_RBut2->isChecked() ) // Extrusion by normal
{
- extrusionByNormal( aMeshEditor, makeGroups );
- }
- else if ( makeGroups ) // create groups
- {
- SMESH::ListOfGroups_var groups;
- if( CheckBoxMesh->isChecked() )
- switch (GetConstructorId() ) {
- case 0:
- groups = aMeshEditor->ExtrusionSweepObject0DMakeGroups(mySelectedObject, aVector,
- aNbSteps); break;
- case 1:
- groups = aMeshEditor->ExtrusionSweepObject1DMakeGroups(mySelectedObject, aVector,
- aNbSteps); break;
- case 2:
- groups = aMeshEditor->ExtrusionSweepObject2DMakeGroups(mySelectedObject, aVector,
- aNbSteps); break;
- }
- else
- {
- if (GetConstructorId() == 0)
- groups = aMeshEditor->ExtrusionSweepMakeGroups0D(myElementsId.inout(), aVector,
- aNbSteps);
- else
- groups = aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector,
- aNbSteps);
- }
+ double stepSize = (double) SpinBox_VDist->value();
+ long nbSteps = (long) SpinBox_NbSteps->value();
+ bool useInputElemsOnly = UseInputElemsOnlyCheck->isChecked();
+ bool byAverageNormal = ByAverageNormalCheck->isChecked();
+ int dim = (maxSelType == SMESH::FACE) ? 2 : 1;
+
+ groups = meshEditor->ExtrusionByNormal( faces, stepSize, nbSteps, useInputElemsOnly,
+ byAverageNormal, makeGroups, dim );
}
- else // no groups
+ else
{
- if( CheckBoxMesh->isChecked() )
- switch( GetConstructorId() ) {
- case 0:
- aMeshEditor->ExtrusionSweepObject0D(mySelectedObject, aVector, aNbSteps);
- break;
- case 1:
- aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps);
- break;
- case 2:
- aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps);
- break;
- }
- else
- if (GetConstructorId() == 0)
- aMeshEditor->ExtrusionSweep0D(myElementsId.inout(), aVector, aNbSteps);
- else
- aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
+ groups = meshEditor->ExtrusionSweepObjects( nodes, edges, faces,
+ aVector, aNbSteps, makeGroups );
}
} catch (...) {
}
- if ( myActor && !meshHadNewTypeBefore )
+ SMESH_Actor* actor = SelectorWdg->GetActor();
+ if ( actor && !meshHadNewTypeBefore )
{
- unsigned int aMode = myActor->GetEntityMode();
- switch ( GetConstructorId() ) {
- case 0: // extrude node -> edges
- myActor->SetRepresentation(SMESH_Actor::eEdge);
- myActor->SetEntityMode( aMode |= SMESH_Actor::eEdges ); break;
- case 1: // edge -> faces
- myActor->SetRepresentation(SMESH_Actor::eSurface);
- myActor->SetEntityMode( aMode |= SMESH_Actor::eFaces ); break;
- case 2: // 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::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();
}
}
}
-//=================================================================================
-// function : onTextChange()
-// purpose :
-//=================================================================================
-void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
-{
- QLineEdit* send = (QLineEdit*)sender();
-
- // return if busy
- if (myBusy) return;
-
- // set busy flag
- myBusy = true;
-
- if (send == LineEditElements)
- myNbOkElements = 0;
-
- // hilight entered elements/nodes
-
- if (!myIO.IsNull()) {
- QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
-
- if (send == LineEditElements)
- {
- SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
- SMESH::ElementType SMESHType;
- SMDSAbs_ElementType SMDSType;
- switch (GetConstructorId()) {
- case 0:
- {
- SMESHType = SMESH::NODE;
- SMDSType = SMDSAbs_Node;
- break;
- }
- case 1:
- {
- SMESHType = SMESH::EDGE;
- SMDSType = SMDSAbs_Edge;
- break;
- }
- case 2:
- {
- SMESHType = SMESH::FACE;
- SMDSType = SMDSAbs_Face;
- break;
- }
- }
- myElementsId = new SMESH::long_array;
- myElementsId->length( aListId.count() );
- TColStd_MapOfInteger newIndices;
- for (int i = 0; i < aListId.count(); i++) {
- int id = aListId[ i ].toInt();
- bool validId = false;
- if ( id > 0 ) {
- if ( aMesh ) {
- const SMDS_MeshElement * e;
- if (SMDSType == SMDSAbs_Node)
- e = aMesh->FindNode( id );
- else
- e = aMesh->FindElement( id );
- validId = ( e && e->GetType() == SMDSType );
- } else {
- validId = ( myMesh->GetElementType( id, true ) == SMESHType );
- }
- }
- if ( validId && newIndices.Add( id ))
- myElementsId[ newIndices.Extent()-1 ] = id;
- }
- myElementsId->length( myNbOkElements = newIndices.Extent() );
- mySelector->AddOrRemoveIndex(myIO, newIndices, false);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( myIO, true, true );
- }
- }
-
- CheckIsEnable();
-
- onDisplaySimulation(true);
-
- myBusy = false;
-}
-
//=================================================================================
// function : SelectionIntoArgument()
-// purpose : Called when selection as changed or other case
+// purpose : Called when selection has changed or other case
//=================================================================================
void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
{
- if (myBusy) return;
-
// return if dialog box is inactive
if (!GroupButtons->isEnabled())
return;
- // clear
- if(myEditCurrentArgument != (QWidget*)SpinBox_Vx) {
- myActor = 0;
- Handle(SALOME_InteractiveObject) resIO = myIO;
- myIO.Nullify();
- }
-
- QString aString = "";
- // set busy flag
- if(myEditCurrentArgument == (QWidget*)LineEditElements) {
- myBusy = true;
- LineEditElements->setText(aString);
- myNbOkElements = 0;
- myBusy = false;
- }
- // get selected mesh
- SALOME_ListIO aList;
- mySelectionMgr->selectedObjects(aList);
- int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
- if (nbSel != 1)
- return;
-
- Handle(SALOME_InteractiveObject) IO = aList.First();
-
- if(myEditCurrentArgument != (QWidget*)SpinBox_Vx) {
- myMesh = SMESH::GetMeshByIO(IO);
- if (myMesh->_is_nil())
+ if ( SelectVectorButton->isChecked() )
+ {
+ SALOME_ListIO aList;
+ mySelectionMgr->selectedObjects(aList);
+ if ( aList.IsEmpty() || aList.Extent() > 1 )
return;
- myIO = IO;
- myActor = SMESH::FindActorByObject(myMesh);
- }
-
- if (myEditCurrentArgument == (QWidget*)LineEditElements) {
- int aNbElements = 0;
-
- // 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 {
- // get indices of selected elements
- TColStd_IndexedMapOfInteger aMapIndex;
- mySelector->GetIndex(IO,aMapIndex);
- aNbElements = aMapIndex.Extent();
-
- if (aNbElements < 1)
- return;
-
- myElementsId = new SMESH::long_array;
- myElementsId->length( aNbElements );
- aString = "";
- for ( int i = 0; i < aNbElements; ++i )
- aString += QString(" %1").arg( myElementsId[ i ] = aMapIndex( i+1 ) );
- }
-
- myNbOkElements = true;
- myBusy = true;
- ((QLineEdit*)myEditCurrentArgument)->setText(aString);
- myBusy = false;
- }
- else if(myEditCurrentArgument == (QWidget*)SpinBox_Vx){
+ Handle(SALOME_InteractiveObject) IO = aList.First();
TColStd_IndexedMapOfInteger aMapIndex;
mySelector->GetIndex(IO,aMapIndex);
- int aNbElements = aMapIndex.Extent();
- SMESH::SMESH_Mesh_var aMesh_var = SMESH::GetMeshByIO(IO);
- SMESH_Actor* anActor = SMESH::FindActorByObject(aMesh_var);
- SMDS_Mesh* aMesh = anActor ? anActor->GetObject()->GetMesh() : 0;
-
- if(aNbElements != 1 || !aMesh)
+ if ( aMapIndex.Extent() != 1 )
+ return;
+ SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
+ SMDS_Mesh* aMesh = anActor ? anActor->GetObject()->GetMesh() : 0;
+ if ( !aMesh )
return;
-
- const SMDS_MeshFace* face = dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aMapIndex(aNbElements)));
+ const SMDS_MeshFace* face =
+ dynamic_cast<const SMDS_MeshFace*>(aMesh->FindElement(aMapIndex(1)));
if (!face)
return;
SpinBox_Vx->SetValue(aNormale.X());
SpinBox_Vy->SetValue(aNormale.Y());
SpinBox_Vz->SetValue(aNormale.Z());
-
}
-
+
onDisplaySimulation(true);
-
- // OK
CheckIsEnable();
}
mySelectionMgr->clearSelected();
mySelectionMgr->clearFilters();
- if (send == SelectElementsButton) {
- myEditCurrentArgument = (QWidget*)LineEditElements;
- if (CheckBoxMesh->isChecked())
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(ActorSelection);
- switch( GetConstructorId() ) {
- case 0: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter0D); break;
- case 1: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter1D); break;
- case 2: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter2D); break;
- }
- }
- else
- {
- int aConstructorId = GetConstructorId();
- switch(aConstructorId) {
- case 0:
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(NodeSelection);
- break;
- }
- case 1:
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
- break;
- }
- case 2:
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- break;
- }
- }
- }
- }
- else if (send == SelectVectorButton){
- myEditCurrentArgument = (QWidget*)SpinBox_Vx;
+ if (send == SelectVectorButton)
+ {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(FaceSelection);
}
- myEditCurrentArgument->setFocus();
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
SelectionIntoArgument();
}
//=================================================================================
void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
{
- if (ConstructorsBox->isEnabled()) {
- ConstructorsBox->setEnabled(false);
+ if (GroupButtons->isEnabled())
+ {
GroupArguments->setEnabled(false);
GroupButtons->setEnabled(false);
+ SelectorWdg->setEnabled(false);
mySMESHGUI->ResetState();
mySMESHGUI->SetActiveDialogBox(0);
}
{
// Emit a signal to deactivate the active dialog
mySMESHGUI->EmitSignalDeactivateDialog();
- ConstructorsBox->setEnabled(true);
GroupArguments->setEnabled(true);
GroupButtons->setEnabled(true);
+ SelectorWdg->setEnabled(true);
mySMESHGUI->SetActiveDialogBox(this);
-
- ConstructorsClicked(GetConstructorId());
- SelectionIntoArgument();
}
//=================================================================================
//=================================================================================
void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*)
{
- if (!ConstructorsBox->isEnabled())
+ if (!GroupButtons->isEnabled())
ActivateThisDialog();
}
-//=================================================================================
-// function : onSelectMesh()
-// purpose :
-//=================================================================================
-void SMESHGUI_ExtrusionDlg::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();
- return;
- }
-
- mySelectionMgr->clearFilters();
-
- if (toSelectMesh)
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(ActorSelection);
- switch( GetConstructorId() ) {
- case 0: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter0D); break;
- case 1: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter1D); break;
- case 2: mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter2D); break;
- }
- LineEditElements->setReadOnly(true);
- LineEditElements->setValidator(0);
- }
- else
- {
- int aConstructorId = GetConstructorId();
- switch(aConstructorId) {
- case 0:
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(NodeSelection);
- break;
- }
- case 1:
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(EdgeSelection);
- break;
- }
- case 2:
- {
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
- break;
- }
- }
- LineEditElements->setReadOnly(false);
- LineEditElements->setValidator(myIdValidator);
- onTextChange(LineEditElements->text());
- }
-
- SelectionIntoArgument();
-
- if (!toSelectMesh)
- LineEditElements->setText( myIDs );
-}
-
-//=================================================================================
-// function : GetConstructorId()
-// purpose :
-//=================================================================================
-int SMESHGUI_ExtrusionDlg::GetConstructorId()
-{
- return GroupConstructors->checkedId();
-}
-
//=================================================================================
// function : keyPressEvent()
// purpose :
}
}
-//=================================================================================
-// function : setFilters()
-// purpose : SLOT. Called when "Filter" button pressed.
-//=================================================================================
-void SMESHGUI_ExtrusionDlg::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::NODE );
- types.append( SMESH::EDGE );
- types.append( SMESH::FACE );
- myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, types );
- }
- switch( GetConstructorId() ){
- case 0:
- {
- myFilterDlg->Init( SMESH::NODE );
- break;
- }
- case 1:
- {
- myFilterDlg->Init( SMESH::EDGE );
- break;
- }
- case 2:
- {
- myFilterDlg->Init( SMESH::FACE );
- break;
- }
- }
-
-
- myFilterDlg->SetSelection();
- myFilterDlg->SetMesh( myMesh );
- myFilterDlg->SetSourceWg( LineEditElements );
-
- myFilterDlg->show();
-}
-
//=================================================================================
// function : isValid
// purpose :
void SMESHGUI_ExtrusionDlg::onDisplaySimulation( bool toDisplayPreview )
{
if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
- if (myNbOkElements && isValid() && isValuesValid()) {
+ if ( SelectorWdg->IsAnythingSelected() && isValid() && isValuesValid())
+ {
//Get input vector
SMESH::DirStruct aVector;
getExtrusionVector(aVector);
try
{
SUIT_OverrideCursor aWaitCursor;
- SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
+
+ 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();
+ const int maxSelType = SelectorWdg->GetSelected( nodes, edges, faces );
+ const bool makeGroups = false;
if ( ExtrMethod_RBut2->isVisible() &&
ExtrMethod_RBut2->isChecked() ) // Extrusion by normal
{
- extrusionByNormal( aMeshEditor );
- }
- else if ( CheckBoxMesh->isChecked() ) // Extrude the whole object
- {
- switch (GetConstructorId()) {
- case 0:
- {
- aMeshEditor->ExtrusionSweepObject0D(mySelectedObject, aVector, aNbSteps);
- break;
- }
- case 1:
- {
- aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps);
- break;
- }
- case 2:
- {
- aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps);
- break;
- }
- }
+ double stepSize = (double) SpinBox_VDist->value();
+ long nbSteps = (long) SpinBox_NbSteps->value();
+ bool useInputElemsOnly = UseInputElemsOnlyCheck->isChecked();
+ bool byAverageNormal = ByAverageNormalCheck->isChecked();
+ int dim = (maxSelType == SMESH::FACE) ? 2 : 1;
+
+ groups = meshEditor->ExtrusionByNormal( faces, stepSize, nbSteps, useInputElemsOnly,
+ byAverageNormal, makeGroups, dim );
}
- else // extrude some elements
+ else
{
- if(GetConstructorId() == 0)
- aMeshEditor->ExtrusionSweep0D(myElementsId.inout(), aVector, aNbSteps);
- else
- aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
+ groups = meshEditor->ExtrusionSweepObjects( nodes, edges, faces,
+ aVector, aNbSteps, makeGroups );
}
- SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
+ SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData();
mySimulation->SetData(aMeshPreviewStruct._retn());
+
} catch (...) {
hidePreview();
}
aVector.PS.z = aNormale.Z()*aVDist;
}
}
-
-//=======================================================================
-//function : extrusionByNormal
-//purpose : performs extrusion by normal
-//=======================================================================
-
-void SMESHGUI_ExtrusionDlg::extrusionByNormal( SMESH::SMESH_MeshEditor_ptr meshEditor,
- const bool makeGroups)
-{
- SMESH::SMESH_IDSource_wrap anIDSource;
- if ( CheckBoxMesh->isChecked() )
- {
- anIDSource = mySelectedObject;
- anIDSource->Register();
- }
- else // make a temporary id source
- {
- anIDSource = meshEditor->MakeIDSource( myElementsId, SMESH::ALL );
- }
-
- double stepSize = (double) SpinBox_VDist->value();
- long nbSteps = (long)SpinBox_NbSteps->value();
- bool useInputElemsOnly = UseInputElemsOnlyCheck->isChecked();
- bool byAverageNormal = ByAverageNormalCheck->isChecked();
- int dim = GetConstructorId();
-
- SMESH::ListOfGroups_var groups =
- meshEditor->ExtrusionByNormal( anIDSource, stepSize, nbSteps,
- useInputElemsOnly, byAverageNormal, makeGroups, dim );
-}
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_PreviewDlg.h"
+#include "SMESHGUI_Utils.h"
// SALOME GUI includes
#include <SALOME_InteractiveObject.hxx>
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();
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;
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();
void SelectionIntoArgument();
void DeactivateActiveDialog();
void ActivateThisDialog();
- void onTextChange( const QString& );
- void onSelectMesh( bool );
- void setFilters();
};
#endif // SMESHGUI_EXTRUSIONDLG_H
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();
}
if( aMeshGroupSO )
anEntryList.append( aMeshGroupSO->GetID().c_str() );
+ resultGroup->SetName(SMESH::toUtf8(myName->text().trimmed()));
+
if ( isCreation )
{
SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" );
}
else
{
- resultGroup->SetName(SMESH::toUtf8(myName->text()));
-
if ( aMeshGroupSO )
{
if ( SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str()))
#include <utilities.h>
// SALOME GUI includes
-#include <SUIT_Session.h>
+#include <LightApp_Application.h>
#include <SUIT_MessageBox.h>
+#include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h>
-#include <LightApp_Application.h>
+#include <SUIT_Session.h>
#include <SalomeApp_IntSpinBox.h>
// Qt includes
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() ) {
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
sourceEdited();
- //selectionChanged();
+ if ( mySource->text().isEmpty() )
+ selectionChanged();
}
/*!
selMgr->installFilter( myFilter );
connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) );
+
+ if ( mySource->text().isEmpty() )
+ selectionChanged();
}
/*!
{
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;
}
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
aViewWindow->highlight(anIO,true,true);
}
}
+ else
+ {
+ QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
+ myNbOkElements = aListId.count();
+ }
myBusy = false;
updateButtons();
#include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_MeshEditPreview.h"
#include "SMESHGUI_FilterDlg.h"
+#include "SMESHGUI_ExtrusionDlg.h"
#include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx>
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);
setWindowTitle(tr("REVOLUTION_AROUND_AXIS"));
setSizeGripEnabled(true);
-
+
QVBoxLayout* SMESHGUI_RevolutionDlgLayout = new QVBoxLayout(this);
SMESHGUI_RevolutionDlgLayout->setSpacing(SPACING);
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);
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);
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);
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);
GroupButtonsLayout->addWidget(buttonHelp);
/***************************************************************/
- SMESHGUI_RevolutionDlgLayout->addWidget(ConstructorsBox);
SMESHGUI_RevolutionDlgLayout->addWidget(GroupArguments);
SMESHGUI_RevolutionDlgLayout->addWidget(GroupButtons);
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();
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()));
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(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ 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()), 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()));
connect(SpinBox_Angle, SIGNAL(textChanged(const QString&)), this, SLOT(onAngleTextChange(const QString&)));
- ConstructorsClicked(0);
- SelectionIntoArgument();
+ CheckIsEnable();
}
//=================================================================================
//=================================================================================
SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg()
{
- delete mySimulation;
- if ( myFilterDlg ) {
- myFilterDlg->setParent( 0 );
- delete myFilterDlg;
- myFilterDlg = 0;
- }
}
//=================================================================================
//=================================================================================
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);
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)
-{
- disconnect(mySelectionMgr, 0, this, 0);
-
- /* SALOME_ListIO io;
- mySelectionMgr->selectedObjects( io );
- SALOME_ListIO aList;
- mySelectionMgr->setSelectedObjects( aList );*/
- buttonApply->setEnabled(false);
- buttonOk->setEnabled(false);
- mySimulation->SetVisibility(false);
+void SMESHGUI_RevolutionDlg::CheckIsEnable()
+{
+ bool anIsEnable = SelectorWdg->IsAnythingSelected() && IsAxisOk();
- Selection_Mode aSelMode = ActorSelection;
+ buttonOk->setEnabled(anIsEnable);
+ buttonApply->setEnabled(anIsEnable);
+}
- switch (constructorId) {
- case 0:
- {
- GroupArguments->setTitle(tr("REVOLUTION_1D"));
- aSelMode = EdgeSelection;
- break;
- }
- case 1:
- {
- GroupArguments->setTitle(tr("REVOLUTION_2D"));
- aSelMode = FaceSelection;
- break;
- }
- }
+//=================================================================================
+// 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;
- if (myEditCurrentArgument != (QWidget*)LineEditElements) {
- SMESH::SetPointRepresentation(false);
+ 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 (!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;
}
//=================================================================================
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;
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 )
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();
-
- 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::SMESH_MeshEditor_var aMeshEditor = mesh->GetMeshEditor();
+
+ 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();
}
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;
+
+ if ( SelectVectorButton->isChecked() ||
+ SelectPointButton->isChecked() )
+ {
+ // get selected mesh
+ SALOME_ListIO aList;
+ mySelectionMgr->selectedObjects(aList);
+ int nbSel = aList.Extent();
+ if (nbSel != 1)
+ 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 {
+ Handle(SALOME_InteractiveObject) IO = aList.First();
+ TColStd_IndexedMapOfInteger aMapIndex;
+ mySelector->GetIndex(IO,aMapIndex);
+ if ( aMapIndex.Extent() != 1 )
+ return;
- SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
- if (!aMesh)
+ 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 &&
+ (myEditCurrentArgument == (QWidget*)SpinBox_DX &&
myVectorDefinition==POINT_SELECT));
- bool isFaceSelected = (myEditCurrentArgument == (QWidget*)SpinBox_DX &&
+ 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();
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());
SpinBox_DZ->SetValue(aNormale.Z());
-
- }
- }
-
- myBusy = true;
- if (myEditCurrentArgument == (QWidget*)LineEditElements)
- LineEditElements->setText(aString);
- myBusy = false;
- // OK
- if (myNbOkElements && IsAxisOk()) {
- buttonOk->setEnabled(true);
- buttonApply->setEnabled(true);
+ }
}
+ CheckIsEnable();
onDisplaySimulation(true);
}
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();
}
//=================================================================================
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);
}
{
/* 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();
}
//=================================================================================
//=================================================================================
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 :
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 :
{
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();
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
{
// function : onSelectVectorButton()
// purpose : [slot]
//=================================================================================
-void SMESHGUI_RevolutionDlg::onSelectVectorButton(){
+void SMESHGUI_RevolutionDlg::onSelectVectorButton()
+{
if(SelectVectorMenu) {
SelectVectorMenu->exec( QCursor::pos() );
}
// function : onSelectVectorMenu()
// purpose : [slot]
//=================================================================================
-void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action){
+void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action)
+{
if(!action)
return;
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;
-}
#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 SALOME_Actor;
class SMESHGUI;
+class SMESHGUI_3TypesSelector;
class SMESHGUI_FilterDlg;
+class SMESHGUI_IdValidator;
+class SMESHGUI_MeshEditPreview;
+class SMESHGUI_SpinBox;
class SMESH_Actor;
-class SVTK_Selector;
-class LightApp_SelectionMgr;
class SMESH_LogicalFilter;
-class SALOME_Actor;
-class SMESHGUI_MeshEditPreview;
-class QMenu;
-class QAction;
+class SVTK_Selector;
+class SalomeApp_IntSpinBox;
//=================================================================================
// class : SMESHGUI_RevolutionDlg
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;
-
- SMESH::SMESH_IDSource_var mySelectedObject;
-
- bool myBusy;
- SMESH::SMESH_Mesh_var myMesh;
- SMESH_Actor* myActor;
- SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter;
- SMESHGUI_MeshEditPreview* mySimulation;
- SALOME_Actor* myPreviewActor;
+ QWidget* myEditCurrentArgument; /* Current argument */
- QGroupBox* ConstructorsBox;
- QButtonGroup* GroupConstructors;
- QRadioButton* RadioButton1;
- QRadioButton* RadioButton2;
+ SMESHGUI_3TypesSelector* SelectorWdg;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonHelp;
QGroupBox* GroupArguments;
QGroupBox* GroupAxis;
- QLabel* TextLabelElements;
- QPushButton* SelectElementsButton;
- QLineEdit* LineEditElements;
- QCheckBox* CheckBoxMesh;
QCheckBox* MakeGroupsCheck;
QGroupBox* GroupAngleBox;
QButtonGroup* GroupAngle;
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();
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
}
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);
}
}
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);
}
}
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);
}
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 ) )
}
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();
}
// 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
</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>
</message>
<message>
<source>SMESH_ADD_SUBMESH</source>
- <translation>SubMesh Construction</translation>
+ <translation>Sub-mesh Construction</translation>
</message>
<message>
<source>SMESH_ADD_TETRAS</source>
</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>
</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>
<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>
</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>
<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>
</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>
</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>
</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>
<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>
</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>
</message>
<message>
<source>MESH_OR_SUBMESH</source>
- <translation>Mesh or SubMesh</translation>
+ <translation>Mesh or Sub-mesh</translation>
</message>
<message>
<source>PATTERN</source>
</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>
</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 "%1"</translation>
+ <translation>No sense in creating a sub-mesh ignored by global algorithm "%1"</translation>
</message>
<message>
<source>GEOMETRY_OBJECT_IS_NOT_DEFINED_MESH</source>
</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>
<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>
<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>
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& );
"ExtrusionSweepObjectMakeGroups","ExtrusionSweepObject0D",
"ExtrusionSweepObject1D","ExtrusionSweepObject1DMakeGroups",
"ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups",
+ "ExtrusionSweepObjects","RotationSweepObjects","ExtrusionAlongPathObjects",
"Translate","TranslateMakeGroups","TranslateMakeMesh",
"TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh",
"ExtrusionAlongPathX","ExtrusionAlongPathObjX","SplitHexahedraIntoPrisms"
"ExportCGNS","ExportGMF",
"Create0DElementsOnAllNodes","Reorient2D","QuadTo4Tri",
"ScaleMakeGroups","Scale","ScaleMakeMesh",
- "FindCoincidentNodesOnPartBut","DoubleElements"
+ "FindCoincidentNodesOnPartBut","DoubleElements",
+ "ExtrusionSweepObjects","RotationSweepObjects","ExtrusionAlongPathObjects"
,"" }; // <- mark of the end
methodsAcceptingList.Insert( methodNames );
}
"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",
{
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();
aMap.insert( aMap.end(), elem );
}
}
- //================================================================================
- /*!
- * \brief Retrieve elements of given type from SMESH_IDSource
- */
- //================================================================================
-
- 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)
-
- {
- if ( error ) *error = IDSource_OK;
- if ( CORBA::is_nil( theIDSource ) )
- {
- if ( error ) *error = IDSource_INVALID;
- return false;
- }
- if ( emptyIfIsMesh && SMESH::DownCast<SMESH_Mesh_i*>( theIDSource ))
- {
- if ( error && theMeshDS->GetMeshInfo().NbElements( theType ) == 0 )
- *error = IDSource_EMPTY;
- return true;
- }
- SMESH::long_array_var anIDs = theIDSource->GetIDs();
- if ( anIDs->length() == 0 )
- {
- if ( error ) *error = IDSource_EMPTY;
- return false;
- }
- SMESH::array_of_ElementType_var types = theIDSource->GetTypes();
- if ( types->length() == 1 && types[0] == SMESH::NODE ) // group of nodes
- {
- if ( theType == SMDSAbs_All || theType == SMDSAbs_Node )
- {
- arrayToSet( anIDs, theMeshDS, theElemSet, SMDSAbs_Node );
- }
- else
- {
- if ( error ) *error = IDSource_INVALID;
- return false;
- }
- }
- else
- {
- arrayToSet( anIDs, theMeshDS, theElemSet, theType);
- if ( bool(anIDs->length()) != bool(theElemSet.size()))
- {
- if ( error ) *error = IDSource_INVALID;
- return false;
- }
- }
- return true;
- }
//================================================================================
/*!
* \brief Retrieve nodes from SMESH_IDSource
TPythonDump pyDump;
TIDSortedElemSet elements, elems0D;
- prepareIdSource( theObject );
if ( idSourceToSet( theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
getEditor().Create0DElementsOnAllNodes( elements, elems0D );
initData(/*deleteSearchers=*/false);
TIDSortedElemSet elements;
- prepareIdSource( the2Dgroup );
IDSource_Error error;
idSourceToSet( the2Dgroup, getMeshDS(), elements, SMDSAbs_Face, /*emptyIfIsMesh=*/1, &error );
if ( error == IDSource_EMPTY )
initData();
TIDSortedElemSet volumes;
- prepareIdSource( volumeGroup );
IDSource_Error volsError;
idSourceToSet( volumeGroup, getMeshDS(), volumes, SMDSAbs_Volume, /*emptyIfMesh=*/1, &volsError);
for ( size_t i = 0; i < faceGroups.length(); ++i )
{
SMESH::SMESH_IDSource_ptr faceGrp = faceGroups[i].in();
- prepareIdSource( faceGrp );
TIDSortedElemSet faces;
IDSource_Error error;
initData();
TIDSortedElemSet faces;
- prepareIdSource( theObject );
if ( !idSourceToSet( theObject, getMeshDS(), faces, SMDSAbs_Face, /*emptyIfIsMesh=*/true ) &&
faces.empty() )
THROW_SALOME_CORBA_EXCEPTION("No faces given", SALOME::BAD_PARAM);
{
SMESH_TRY;
initData();
- prepareIdSource( elems );
::SMESH_MeshEditor::TFacetOfElem elemSet;
const int noneFacet = -1;
}
//=======================================================================
-//function : rotationSweep
+//function : RotationSweepObjects
//purpose :
//=======================================================================
SMESH::ListOfGroups*
-SMESH_MeshEditor_i::rotationSweep(const SMESH::long_array & theIDsOfElements,
- const SMESH::AxisStruct & theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance,
- const bool theMakeGroups,
- const SMDSAbs_ElementType theElementType)
+SMESH_MeshEditor_i::RotationSweepObjects(const SMESH::ListOfIDSources & theNodes,
+ const SMESH::ListOfIDSources & theEdges,
+ const SMESH::ListOfIDSources & theFaces,
+ const SMESH::AxisStruct & theAxis,
+ CORBA::Double theAngleInRadians,
+ CORBA::Long theNbOfSteps,
+ CORBA::Double theTolerance,
+ const bool theMakeGroups)
throw (SALOME::SALOME_Exception)
{
SMESH_TRY;
initData();
- TIDSortedElemSet inElements, copyElements;
- arrayToSet(theIDsOfElements, getMeshDS(), inElements, theElementType);
+ TIDSortedElemSet elemsNodes[2];
+ for ( int i = 0, nb = theNodes.length(); i < nb; ++i ) {
+ SMDS_ElemIteratorPtr nIt = myMesh_i->GetElements( theNodes[i], SMESH::NODE );
+ while ( nIt->more() ) elemsNodes[1].insert( nIt->next() );
+ }
+ for ( int i = 0, nb = theEdges.length(); i < nb; ++i )
+ idSourceToSet( theEdges[i], getMeshDS(), elemsNodes[0], SMDSAbs_Edge );
+ for ( int i = 0, nb = theFaces.length(); i < nb; ++i )
+ idSourceToSet( theFaces[i], getMeshDS(), elemsNodes[0], SMDSAbs_Face );
- TIDSortedElemSet* workElements = & inElements;
+ TIDSortedElemSet* workElements = & elemsNodes[0], copyElements[2];
bool makeWalls=true;
if ( myIsPreviewMode )
{
SMDSAbs_ElementType select = SMDSAbs_All, avoid = SMDSAbs_Volume;
- getPreviewMesh( SMDSAbs_Face )->Copy( inElements, copyElements, select, avoid );
- workElements = & copyElements;
- //makeWalls = false;
+ TPreviewMesh * tmpMesh = getPreviewMesh();
+ tmpMesh->Copy( elemsNodes[0], copyElements[0], select, avoid );
+ tmpMesh->Copy( elemsNodes[1], copyElements[1], select, avoid );
+ workElements = & copyElements[0];
+ //makeWalls = false; -- faces are needed for preview
}
+ TPythonDump aPythonDump; // it is here to prevent dump of getGroups()
+
gp_Ax1 Ax1 (gp_Pnt( theAxis.x, theAxis.y, theAxis.z ),
gp_Vec( theAxis.vx, theAxis.vy, theAxis.vz ));
::SMESH_MeshEditor::PGroupIDs groupIds =
- getEditor().RotationSweep (*workElements, Ax1, theAngleInRadians,
+ getEditor().RotationSweep (workElements, Ax1, theAngleInRadians,
theNbOfSteps, theTolerance, theMakeGroups, makeWalls);
- declareMeshModified( /*isReComputeSafe=*/true ); // does not influence Compute()
-
- return theMakeGroups ? getGroups(groupIds.get()) : 0;
-
- SMESH_CATCH( SMESH::throwCorbaException );
- return 0;
-}
-
-//=======================================================================
-//function : RotationSweep
-//purpose :
-//=======================================================================
-
-void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElements,
- const SMESH::AxisStruct & theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
- throw (SALOME::SALOME_Exception)
-{
- if ( !myIsPreviewMode ) {
- TPythonDump() << this << ".RotationSweep( "
- << theIDsOfElements << ", "
- << theAxis << ", "
- << TVar( theAngleInRadians ) << ", "
- << TVar( theNbOfSteps ) << ", "
- << TVar( theTolerance ) << " )";
- }
- rotationSweep(theIDsOfElements,
- theAxis,
- theAngleInRadians,
- theNbOfSteps,
- theTolerance,
- false);
-}
-
-//=======================================================================
-//function : RotationSweepMakeGroups
-//purpose :
-//=======================================================================
+ SMESH::ListOfGroups * aGroups = theMakeGroups ? getGroups( groupIds.get()) : 0;
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::RotationSweepMakeGroups(const SMESH::long_array& theIDsOfElements,
- const SMESH::AxisStruct& theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+ declareMeshModified( /*isReComputeSafe=*/true ); // does not influence Compute()
- SMESH::ListOfGroups *aGroups = rotationSweep(theIDsOfElements,
- theAxis,
- theAngleInRadians,
- theNbOfSteps,
- theTolerance,
- true);
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".RotationSweepMakeGroups( "
- << theIDsOfElements << ", "
+ if ( !myIsPreviewMode )
+ {
+ dumpGroupsList( aPythonDump, aGroups );
+ aPythonDump << this<< ".RotationSweepObjects( "
+ << theNodes << ", "
+ << theEdges << ", "
+ << theFaces << ", "
<< theAxis << ", "
<< TVar( theAngleInRadians ) << ", "
<< TVar( theNbOfSteps ) << ", "
- << TVar( theTolerance ) << " )";
- }
- return aGroups;
-}
-
-//=======================================================================
-//function : RotationSweepObject
-//purpose :
-//=======================================================================
-
-void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
- throw (SALOME::SALOME_Exception)
-{
- if ( !myIsPreviewMode ) {
- TPythonDump() << this << ".RotationSweepObject( "
- << theObject << ", "
- << theAxis << ", "
- << theAngleInRadians << ", "
- << theNbOfSteps << ", "
- << theTolerance << " )";
- }
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- rotationSweep(anElementsId,
- theAxis,
- theAngleInRadians,
- theNbOfSteps,
- theTolerance,
- false);
-}
-
-//=======================================================================
-//function : RotationSweepObject1D
-//purpose :
-//=======================================================================
-
-void SMESH_MeshEditor_i::RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
- throw (SALOME::SALOME_Exception)
-{
- if ( !myIsPreviewMode ) {
- TPythonDump() << this << ".RotationSweepObject1D( "
- << theObject << ", "
- << theAxis << ", "
- << TVar( theAngleInRadians ) << ", "
- << TVar( theNbOfSteps ) << ", "
- << TVar( theTolerance ) << " )";
- }
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- rotationSweep(anElementsId,
- theAxis,
- theAngleInRadians,
- theNbOfSteps,
- theTolerance,
- false,
- SMDSAbs_Edge);
-}
-
-//=======================================================================
-//function : RotationSweepObject2D
-//purpose :
-//=======================================================================
-
-void SMESH_MeshEditor_i::RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct & theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
- throw (SALOME::SALOME_Exception)
-{
- if ( !myIsPreviewMode ) {
- TPythonDump() << this << ".RotationSweepObject2D( "
- << theObject << ", "
- << theAxis << ", "
- << TVar( theAngleInRadians ) << ", "
- << TVar( theNbOfSteps ) << ", "
- << TVar( theTolerance ) << " )";
- }
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- rotationSweep(anElementsId,
- theAxis,
- theAngleInRadians,
- theNbOfSteps,
- theTolerance,
- false,
- SMDSAbs_Face);
-}
-
-//=======================================================================
-//function : RotationSweepObjectMakeGroups
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct& theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
- theAxis,
- theAngleInRadians,
- theNbOfSteps,
- theTolerance,
- true);
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".RotationSweepObjectMakeGroups( "
- << theObject << ", "
- << theAxis << ", "
- << theAngleInRadians << ", "
- << theNbOfSteps << ", "
- << theTolerance << " )";
- }
- return aGroups;
-}
-
-//=======================================================================
-//function : RotationSweepObject1DMakeGroups
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct& theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
- theAxis,
- theAngleInRadians,
- theNbOfSteps,
- theTolerance,
- true,
- SMDSAbs_Edge);
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".RotationSweepObject1DMakeGroups( "
- << theObject << ", "
- << theAxis << ", "
- << TVar( theAngleInRadians ) << ", "
- << TVar( theNbOfSteps ) << ", "
- << TVar( theTolerance ) << " )";
+ << TVar( theTolerance ) << ", "
+ << theMakeGroups << " )";
}
- return aGroups;
-}
-
-//=======================================================================
-//function : RotationSweepObject2DMakeGroups
-//purpose :
-//=======================================================================
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::AxisStruct& theAxis,
- CORBA::Double theAngleInRadians,
- CORBA::Long theNbOfSteps,
- CORBA::Double theTolerance)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+ return aGroups ? aGroups : new SMESH::ListOfGroups;
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
- theAxis,
- theAngleInRadians,
- theNbOfSteps,
- theTolerance,
- true,
- SMDSAbs_Face);
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".RotationSweepObject2DMakeGroups( "
- << theObject << ", "
- << theAxis << ", "
- << TVar( theAngleInRadians ) << ", "
- << TVar( theNbOfSteps ) << ", "
- << TVar( theTolerance ) << " )";
- }
- return aGroups;
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
}
namespace MeshEditor_I
}
//=======================================================================
-//function : extrusionSweep
-//purpose :
+/*!
+ * \brief Generate dim+1 elements by extrusion of elements along vector
+ * \param [in] edges - edges to extrude: a list including groups, sub-meshes or a mesh
+ * \param [in] faces - faces to extrude: a list including groups, sub-meshes or a mesh
+ * \param [in] nodes - nodes to extrude: a list including groups, sub-meshes or a mesh
+ * \param [in] stepVector - vector giving direction and distance of an extrusion step
+ * \param [in] nbOfSteps - number of elements to generate from one element
+ * \param [in] 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
+ */
//=======================================================================
SMESH::ListOfGroups*
-SMESH_MeshEditor_i::extrusionSweep(const SMESH::long_array & theIDsOfElements,
- MeshEditor_I::ExtrusionParams& theParams,
- const SMDSAbs_ElementType theElementType)
+SMESH_MeshEditor_i::ExtrusionSweepObjects(const SMESH::ListOfIDSources & theNodes,
+ const SMESH::ListOfIDSources & theEdges,
+ const SMESH::ListOfIDSources & theFaces,
+ const SMESH::DirStruct & theStepVector,
+ CORBA::Long theNbOfSteps,
+ CORBA::Boolean theToMakeGroups)
throw (SALOME::SALOME_Exception)
{
SMESH_TRY;
initData();
- TIDSortedElemSet elements, copyElements;
- arrayToSet( theIDsOfElements, getMeshDS(), elements, theElementType );
+ ExtrusionParams params( theStepVector, theNbOfSteps, theToMakeGroups );
- TIDSortedElemSet* workElements = & elements;
+ TIDSortedElemSet elemsNodes[2];
+ for ( int i = 0, nb = theNodes.length(); i < nb; ++i ) {
+ SMDS_ElemIteratorPtr nIt = myMesh_i->GetElements( theNodes[i], SMESH::NODE );
+ while ( nIt->more() ) elemsNodes[1].insert( nIt->next() );
+ }
+ for ( int i = 0, nb = theEdges.length(); i < nb; ++i )
+ idSourceToSet( theEdges[i], getMeshDS(), elemsNodes[0], SMDSAbs_Edge );
+ for ( int i = 0, nb = theFaces.length(); i < nb; ++i )
+ idSourceToSet( theFaces[i], getMeshDS(), elemsNodes[0], SMDSAbs_Face );
+ TIDSortedElemSet* workElements = & elemsNodes[0], copyElements[2];
if ( myIsPreviewMode )
{
- SMDSAbs_ElementType previewType = SMDSAbs_Face;
- if (theElementType == SMDSAbs_Node)
- previewType = SMDSAbs_Edge;
+ SMDSAbs_ElementType previewType = SMDSAbs_All; //SMDSAbs_Face;
+ // if ( (*elemsNodes.begin())->GetType() == SMDSAbs_Node )
+ // previewType = SMDSAbs_Edge;
SMDSAbs_ElementType select = SMDSAbs_All, avoid = SMDSAbs_Volume;
- getPreviewMesh( previewType )->Copy( elements, copyElements, select, avoid );
- workElements = & copyElements;
- theParams.SetNoGroups();
+ TPreviewMesh * tmpMesh = getPreviewMesh();
+ tmpMesh->Copy( elemsNodes[0], copyElements[0], select, avoid );
+ tmpMesh->Copy( elemsNodes[1], copyElements[1], select, avoid );
+ workElements = & copyElements[0];
- if ( theParams.myIsExtrusionByNormal && !theParams.ToUseInpElemsOnly() )
- {
- TIDSortedElemSet elemsAround, elemsAroundCopy;
- getElementsAround( elements, getMeshDS(), elemsAround );
- getPreviewMesh( previewType )->Copy( elemsAround, elemsAroundCopy, select, avoid );
- }
+ params.SetNoGroups();
}
+ TPythonDump aPythonDump; // it is here to prevent dump of getGroups()
- ::SMESH_MeshEditor::TTElemOfElemListMap aHystory;
+ ::SMESH_MeshEditor::TTElemOfElemListMap aHistory;
::SMESH_MeshEditor::PGroupIDs groupIds =
- getEditor().ExtrusionSweep (*workElements, theParams, aHystory );
+ getEditor().ExtrusionSweep( workElements, params, aHistory );
+
+ SMESH::ListOfGroups * aGroups = theToMakeGroups ? getGroups( groupIds.get()) : 0;
declareMeshModified( /*isReComputeSafe=*/true ); // does not influence Compute()
- return theParams.ToMakeGroups() ? getGroups(groupIds.get()) : 0;
+ if ( !myIsPreviewMode )
+ {
+ dumpGroupsList( aPythonDump, aGroups );
+ aPythonDump << this<< ".ExtrusionSweepObjects( "
+ << theNodes << ", "
+ << theEdges << ", "
+ << theFaces << ", "
+ << theStepVector << ", "
+ << TVar( theNbOfSteps ) << ", "
+ << theToMakeGroups << " )";
+ }
+
+ return aGroups ? aGroups : new SMESH::ListOfGroups;
SMESH_CATCH( SMESH::throwCorbaException );
return 0;
}
//=======================================================================
-//function : ExtrusionSweep
+//function : ExtrusionByNormal
//purpose :
//=======================================================================
-void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElements,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps)
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::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)
{
- ExtrusionParams params( theStepVector, theNbOfSteps, false );
- extrusionSweep( theIDsOfElements, params );
- if (!myIsPreviewMode) {
- TPythonDump() << this << ".ExtrusionSweep( "
- << theIDsOfElements << ", " << theStepVector <<", " << TVar(theNbOfSteps) << " )";
+ SMESH_TRY;
+ initData();
+
+ TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+
+ ExtrusionParams params( stepSize, nbOfSteps, dim,
+ byAverageNormal, useInputElemsOnly, makeGroups );
+
+ SMDSAbs_ElementType elemType = ( dim == 1 ? SMDSAbs_Edge : SMDSAbs_Face );
+ if ( objects.length() > 0 && !SMESH::DownCast<SMESH_Mesh_i*>( objects[0] ))
+ {
+ SMESH::array_of_ElementType_var elemTypes = objects[0]->GetTypes();
+ if (( elemTypes->length() == 1 ) &&
+ ( elemTypes[0] == SMESH::EDGE || elemTypes[0] == SMESH::FACE ))
+ elemType = ( SMDSAbs_ElementType ) elemTypes[0];
}
-}
-//=======================================================================
-//function : ExtrusionSweep0D
-//purpose :
-//=======================================================================
+ TIDSortedElemSet elemsNodes[2];
+ for ( int i = 0, nb = objects.length(); i < nb; ++i )
+ idSourceToSet( objects[i], getMeshDS(), elemsNodes[0], elemType );
-void SMESH_MeshEditor_i::ExtrusionSweep0D(const SMESH::long_array & theIDsOfElements,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps)
- throw (SALOME::SALOME_Exception)
-{
- ExtrusionParams params( theStepVector, theNbOfSteps, false );
- extrusionSweep( theIDsOfElements, params, SMDSAbs_Node );
- if (!myIsPreviewMode) {
- TPythonDump() << this << ".ExtrusionSweep0D( "
- << theIDsOfElements << ", " << theStepVector <<", " << TVar(theNbOfSteps)<< " )";
+ TIDSortedElemSet* workElements = & elemsNodes[0], copyElements[2];
+ if ( myIsPreviewMode )
+ {
+ SMDSAbs_ElementType previewType = SMDSAbs_Face;
+ SMDSAbs_ElementType select = SMDSAbs_All, avoid = SMDSAbs_Volume;
+ TPreviewMesh * tmpMesh = getPreviewMesh( previewType );
+ tmpMesh->Copy( elemsNodes[0], copyElements[0], select, avoid );
+ workElements = & copyElements[0];
+
+ params.SetNoGroups();
}
-}
-//=======================================================================
-//function : ExtrusionSweepObject
-//purpose :
-//=======================================================================
+ ::SMESH_MeshEditor::TTElemOfElemListMap aHistory;
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ getEditor().ExtrusionSweep( workElements, params, aHistory );
+
+ SMESH::ListOfGroups * aGroups = makeGroups ? getGroups( groupIds.get()) : 0;
-void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps)
- throw (SALOME::SALOME_Exception)
-{
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- ExtrusionParams params( theStepVector, theNbOfSteps, false );
- extrusionSweep( anElementsId, params );
if (!myIsPreviewMode) {
- TPythonDump() << this << ".ExtrusionSweepObject( "
- << theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
+ dumpGroupsList(aPythonDump, aGroups);
+ aPythonDump << this << ".ExtrusionByNormal( " << objects
+ << ", " << TVar( stepSize )
+ << ", " << TVar( nbOfSteps )
+ << ", " << byAverageNormal
+ << ", " << makeGroups
+ << ", " << dim
+ << " )";
}
-}
-//=======================================================================
-//function : ExtrusionSweepObject0D
-//purpose :
-//=======================================================================
+ declareMeshModified( /*isReComputeSafe=*/true ); // does not influence Compute()
-void SMESH_MeshEditor_i::ExtrusionSweepObject0D(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps)
- throw (SALOME::SALOME_Exception)
-{
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- if ( anElementsId->length() == 0 )
- if ( SMESH_Mesh_i* mesh = SMESH::DownCast<SMESH_Mesh_i*>( theObject ))
- anElementsId = mesh->GetNodesId();
+ return aGroups ? aGroups : new SMESH::ListOfGroups;
- ExtrusionParams params( theStepVector, theNbOfSteps, false );
- extrusionSweep( anElementsId, params, SMDSAbs_Node );
- if ( !myIsPreviewMode ) {
- TPythonDump() << this << ".ExtrusionSweepObject0D( "
- << theObject << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
- }
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
}
//=======================================================================
-//function : ExtrusionSweepObject1D
+//function : AdvancedExtrusion
//purpose :
//=======================================================================
-void SMESH_MeshEditor_i::ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps)
+SMESH::ListOfGroups*
+SMESH_MeshEditor_i::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)
{
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- ExtrusionParams params( theStepVector, theNbOfSteps, false );
- extrusionSweep( anElementsId, params, SMDSAbs_Edge );
- if ( !myIsPreviewMode ) {
- TPythonDump() << this << ".ExtrusionSweepObject1D( "
- << theObject << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
- }
-}
+ SMESH_TRY;
+ initData();
-//=======================================================================
-//function : ExtrusionSweepObject2D
-//purpose :
-//=======================================================================
+ TPythonDump aPythonDump; // it is here to prevent dump of getGroups()
-void SMESH_MeshEditor_i::ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps)
- throw (SALOME::SALOME_Exception)
-{
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- ExtrusionParams params( theStepVector, theNbOfSteps, false );
- extrusionSweep( anElementsId, params, SMDSAbs_Face );
- if ( !myIsPreviewMode ) {
- TPythonDump() << this << ".ExtrusionSweepObject2D( "
- << theObject << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
- }
-}
-
-//=======================================================================
-//function : ExtrusionSweepMakeGroups
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::ExtrusionSweepMakeGroups(const SMESH::long_array& theIDsOfElements,
- const SMESH::DirStruct& theStepVector,
- CORBA::Long theNbOfSteps)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- ExtrusionParams params( theStepVector, theNbOfSteps, true );
- SMESH::ListOfGroups* aGroups = extrusionSweep( theIDsOfElements, params );
-
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".ExtrusionSweepMakeGroups( " << theIDsOfElements
- << ", " << theStepVector <<", " << TVar( theNbOfSteps ) << " )";
- }
- return aGroups;
-}
-
-//=======================================================================
-//function : ExtrusionSweepMakeGroups0D
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::ExtrusionSweepMakeGroups0D(const SMESH::long_array& theIDsOfElements,
- const SMESH::DirStruct& theStepVector,
- CORBA::Long theNbOfSteps)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- ExtrusionParams params( theStepVector, theNbOfSteps, true );
- SMESH::ListOfGroups* aGroups = extrusionSweep( theIDsOfElements, params, SMDSAbs_Node );
-
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".ExtrusionSweepMakeGroups0D( " << theIDsOfElements
- << ", " << theStepVector <<", " << TVar( theNbOfSteps ) << " )";
- }
- return aGroups;
-}
-
-//=======================================================================
-//function : ExtrusionSweepObjectMakeGroups
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct& theStepVector,
- CORBA::Long theNbOfSteps)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- ExtrusionParams params( theStepVector, theNbOfSteps, true );
- SMESH::ListOfGroups* aGroups = extrusionSweep( anElementsId, params );
-
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".ExtrusionSweepObjectMakeGroups( " << theObject
- << ", " << theStepVector << ", " << theNbOfSteps << " )";
- }
- return aGroups;
-}
-
-//=======================================================================
-//function : ExtrusionSweepObject0DMakeGroups
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::ExtrusionSweepObject0DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct& theStepVector,
- CORBA::Long theNbOfSteps)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- ExtrusionParams params( theStepVector, theNbOfSteps, true );
- SMESH::ListOfGroups* aGroups = extrusionSweep( anElementsId, params, SMDSAbs_Node );
-
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".ExtrusionSweepObject0DMakeGroups( " << theObject
- << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
- }
- return aGroups;
-}
-
-//=======================================================================
-//function : ExtrusionSweepObject1DMakeGroups
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct& theStepVector,
- CORBA::Long theNbOfSteps)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- ExtrusionParams params( theStepVector, theNbOfSteps, true );
- SMESH::ListOfGroups* aGroups = extrusionSweep( anElementsId, params, SMDSAbs_Edge );
+ ExtrusionParams params( theStepVector, theNbOfSteps, theMakeGroups,
+ theExtrFlags, theSewTolerance );
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".ExtrusionSweepObject1DMakeGroups( " << theObject
- << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
- }
- return aGroups;
-}
+ TIDSortedElemSet elemsNodes[2];
+ arrayToSet( theIDsOfElements, getMeshDS(), elemsNodes[0] );
-//=======================================================================
-//function : ExtrusionSweepObject2DMakeGroups
-//purpose :
-//=======================================================================
+ ::SMESH_MeshEditor::TTElemOfElemListMap aHistory;
+ ::SMESH_MeshEditor::PGroupIDs groupIds =
+ getEditor().ExtrusionSweep( elemsNodes, params, aHistory );
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct& theStepVector,
- CORBA::Long theNbOfSteps)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
+ SMESH::ListOfGroups * aGroups = theMakeGroups ? getGroups( groupIds.get()) : 0;
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- ExtrusionParams params( theStepVector, theNbOfSteps, true );
- SMESH::ListOfGroups* aGroups = extrusionSweep( anElementsId, params, SMDSAbs_Face );
+ declareMeshModified( /*isReComputeSafe=*/true ); // does not influence Compute()
- if (!myIsPreviewMode) {
+ if ( !myIsPreviewMode ) {
dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".ExtrusionSweepObject2DMakeGroups( " << theObject
- << ", " << theStepVector << ", " << TVar( theNbOfSteps ) << " )";
- }
- return aGroups;
-}
-
-//=======================================================================
-//function : ExtrusionByNormal
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::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)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- ExtrusionParams params( stepSize, nbOfSteps, dim,
- byAverageNormal, useInputElemsOnly, makeGroups );
-
- SMDSAbs_ElementType elemType = ( dim == 1 ? SMDSAbs_Edge : SMDSAbs_Face );
- if ( !SMESH::DownCast<SMESH_Mesh_i*>( object ))
- {
- SMESH::array_of_ElementType_var elemTypes = object->GetTypes();
- if (( elemTypes->length() == 1 ) &&
- ( elemTypes[0] == SMESH::EDGE || elemTypes[0] == SMESH::FACE ))
- elemType = ( SMDSAbs_ElementType ) elemTypes[0];
+ aPythonDump << this << ".AdvancedExtrusion( "
+ << theIDsOfElements << ", "
+ << theStepVector << ", "
+ << theNbOfSteps << ", "
+ << theExtrFlags << ", "
+ << theSewTolerance << ", "
+ << theMakeGroups << " )";
}
- prepareIdSource( object );
- SMESH::long_array_var anElementsId = object->GetIDs();
- SMESH::ListOfGroups* aGroups = extrusionSweep( anElementsId, params, elemType );
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".ExtrusionByNormal( " << object
- << ", " << TVar( stepSize )
- << ", " << TVar( nbOfSteps )
- << ", " << byAverageNormal
- << ", " << makeGroups
- << ", " << dim
- << " )";
- }
return aGroups ? aGroups : new SMESH::ListOfGroups;
-}
-
-//=======================================================================
-//function : AdvancedExtrusion
-//purpose :
-//=======================================================================
-
-void SMESH_MeshEditor_i::AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
- const SMESH::DirStruct & theStepVector,
- CORBA::Long theNbOfSteps,
- CORBA::Long theExtrFlags,
- CORBA::Double theSewTolerance)
- throw (SALOME::SALOME_Exception)
-{
- ExtrusionParams params( theStepVector, theNbOfSteps, false, theExtrFlags, theSewTolerance);
- extrusionSweep( theIDsOfElements, params );
-
- if ( !myIsPreviewMode ) {
- TPythonDump() << "stepVector = " << theStepVector;
- TPythonDump() << this << ".AdvancedExtrusion("
- << theIDsOfElements
- << ", stepVector, "
- << theNbOfSteps << ","
- << theExtrFlags << ", "
- << theSewTolerance << " )";
- }
-}
-
-//=======================================================================
-//function : AdvancedExtrusionMakeGroups
-//purpose :
-//=======================================================================
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::AdvancedExtrusionMakeGroups(const SMESH::long_array& theIDsOfElements,
- const SMESH::DirStruct& theStepVector,
- CORBA::Long theNbOfSteps,
- CORBA::Long theExtrFlags,
- CORBA::Double theSewTolerance)
- throw (SALOME::SALOME_Exception)
-{
- if (!myIsPreviewMode) {
- TPythonDump() << "stepVector = " << theStepVector;
- }
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- ExtrusionParams params( theStepVector, theNbOfSteps, true, theExtrFlags, theSewTolerance);
- SMESH::ListOfGroups * aGroups = extrusionSweep( theIDsOfElements, params );
- if (!myIsPreviewMode) {
- dumpGroupsList(aPythonDump, aGroups);
- aPythonDump << this << ".AdvancedExtrusionMakeGroups("
- << theIDsOfElements
- << ", stepVector, "
- << theNbOfSteps << ","
- << theExtrFlags << ", "
- << theSewTolerance << " )";
- }
- return aGroups;
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
}
-
//================================================================================
/*!
* \brief Convert extrusion error to IDL enum
*/
//================================================================================
+namespace
+{
#define RETCASE(enm) case ::SMESH_MeshEditor::enm: return SMESH::SMESH_MeshEditor::enm;
-static SMESH::SMESH_MeshEditor::Extrusion_Error convExtrError( const::SMESH_MeshEditor::Extrusion_Error e )
-{
- switch ( e ) {
- RETCASE( EXTR_OK );
- RETCASE( EXTR_NO_ELEMENTS );
- RETCASE( EXTR_PATH_NOT_EDGE );
- RETCASE( EXTR_BAD_PATH_SHAPE );
- RETCASE( EXTR_BAD_STARTING_NODE );
- RETCASE( EXTR_BAD_ANGLES_NUMBER );
- RETCASE( EXTR_CANT_GET_TANGENT );
+ SMESH::SMESH_MeshEditor::Extrusion_Error convExtrError( ::SMESH_MeshEditor::Extrusion_Error e )
+ {
+ switch ( e ) {
+ RETCASE( EXTR_OK );
+ RETCASE( EXTR_NO_ELEMENTS );
+ RETCASE( EXTR_PATH_NOT_EDGE );
+ RETCASE( EXTR_BAD_PATH_SHAPE );
+ RETCASE( EXTR_BAD_STARTING_NODE );
+ RETCASE( EXTR_BAD_ANGLES_NUMBER );
+ RETCASE( EXTR_CANT_GET_TANGENT );
+ }
+ return SMESH::SMESH_MeshEditor::EXTR_OK;
}
- return SMESH::SMESH_MeshEditor::EXTR_OK;
}
-
//=======================================================================
//function : extrusionAlongPath
//purpose :
//=======================================================================
SMESH::ListOfGroups*
-SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array & theIDsOfElements,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array & theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct & theRefPoint,
- const bool theMakeGroups,
- SMESH::SMESH_MeshEditor::Extrusion_Error & theError,
- const SMDSAbs_ElementType theElementType)
+SMESH_MeshEditor_i::ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & theNodes,
+ const SMESH::ListOfIDSources & theEdges,
+ const SMESH::ListOfIDSources & theFaces,
+ SMESH::SMESH_IDSource_ptr thePathMesh,
+ GEOM::GEOM_Object_ptr thePathShape,
+ CORBA::Long theNodeStart,
+ CORBA::Boolean theHasAngles,
+ const SMESH::double_array & theAngles,
+ CORBA::Boolean theLinearVariation,
+ CORBA::Boolean theHasRefPoint,
+ const SMESH::PointStruct & theRefPoint,
+ bool theMakeGroups,
+ SMESH::SMESH_MeshEditor::Extrusion_Error& theError)
throw (SALOME::SALOME_Exception)
{
SMESH_TRY;
- MESSAGE("extrusionAlongPath");
initData();
- if ( thePathMesh->_is_nil() || thePathShape->_is_nil() ) {
- theError = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
- return 0;
- }
- SMESH_Mesh_i* aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( thePathMesh );
+ SMESH::ListOfGroups_var aGroups = new SMESH::ListOfGroups;
- TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape );
- SMESH_subMesh* aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape );
+ theError = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
+ if ( thePathMesh->_is_nil() )
+ return aGroups._retn();
- if ( !aSubMesh || !aSubMesh->GetSubMeshDS()) {
- theError = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
- return 0;
+ // get a sub-mesh
+ SMESH_subMesh* aSubMesh = 0;
+ SMESH_Mesh_i* aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( thePathMesh );
+ if ( thePathShape->_is_nil() )
+ {
+ // thePathMesh should be either a sub-mesh or a mesh with 1D elements only
+ if ( SMESH_subMesh_i* sm = SMESH::DownCast<SMESH_subMesh_i*>( thePathMesh ))
+ {
+ SMESH::SMESH_Mesh_var mesh = thePathMesh->GetMesh();
+ aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
+ if ( !aMeshImp ) return aGroups._retn();
+ aSubMesh = aMeshImp->GetImpl().GetSubMeshContaining( sm->GetId() );
+ if ( !aSubMesh ) return aGroups._retn();
+ }
+ else if ( !aMeshImp ||
+ aMeshImp->NbEdges() != aMeshImp->NbElements() )
+ {
+ return aGroups._retn();
+ }
+ }
+ else
+ {
+ if ( !aMeshImp ) return aGroups._retn();
+ TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape );
+ aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape );
+ if ( !aSubMesh || !aSubMesh->GetSubMeshDS() )
+ return aGroups._retn();
}
- SMDS_MeshNode* nodeStart = (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(theNodeStart);
+ SMDS_MeshNode* nodeStart =
+ (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(theNodeStart);
if ( !nodeStart ) {
theError = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
- return 0;
+ return aGroups._retn();
}
- TIDSortedElemSet elements;
- arrayToSet(theIDsOfElements, getMeshDS(), elements, theElementType);
+ TIDSortedElemSet elemsNodes[2];
+ for ( int i = 0, nb = theNodes.length(); i < nb; ++i ) {
+ SMDS_ElemIteratorPtr nIt = myMesh_i->GetElements( theNodes[i], SMESH::NODE );
+ while ( nIt->more() ) elemsNodes[1].insert( nIt->next() );
+ }
+ for ( int i = 0, nb = theEdges.length(); i < nb; ++i )
+ idSourceToSet( theEdges[i], getMeshDS(), elemsNodes[0], SMDSAbs_Edge );
+ for ( int i = 0, nb = theFaces.length(); i < nb; ++i )
+ idSourceToSet( theFaces[i], getMeshDS(), elemsNodes[0], SMDSAbs_Face );
list<double> angles;
for (int i = 0; i < theAngles.length(); i++) {
int nbOldGroups = myMesh->NbGroup();
- ::SMESH_MeshEditor::Extrusion_Error error =
- getEditor().ExtrusionAlongTrack( elements, aSubMesh, nodeStart,
- theHasAngles, angles, false,
- theHasRefPoint, refPnt, theMakeGroups );
-
- declareMeshModified( /*isReComputeSafe=*/true );
- theError = convExtrError( error );
-
- if ( theMakeGroups ) {
- list<int> groupIDs = myMesh->GetGroupIds();
- list<int>::iterator newBegin = groupIDs.begin();
- std::advance( newBegin, nbOldGroups ); // skip old groups
- groupIDs.erase( groupIDs.begin(), newBegin );
- return getGroups( & groupIDs );
- }
- return 0;
-
- SMESH_CATCH( SMESH::throwCorbaException );
- return 0;
-}
-
-//=======================================================================
-//function : extrusionAlongPathX
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::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 & Error)
- throw (SALOME::SALOME_Exception)
-{
- SMESH_TRY;
- SMESH::ListOfGroups* EmptyGr = new SMESH::ListOfGroups;
-
- initData();
-
- list<double> angles;
- for (int i = 0; i < Angles.length(); i++) {
- angles.push_back( Angles[i] );
- }
- gp_Pnt refPnt( RefPoint.x, RefPoint.y, RefPoint.z );
- int nbOldGroups = myMesh->NbGroup();
-
- if ( Path->_is_nil() ) {
- Error = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
- return EmptyGr;
- }
-
- TIDSortedElemSet elements, copyElements;
- arrayToSet(IDsOfElements, getMeshDS(), elements, ElementType);
-
- TIDSortedElemSet* workElements = &elements;
-
+ TIDSortedElemSet* workElements = & elemsNodes[0], copyElements[2];
if ( myIsPreviewMode )
{
SMDSAbs_ElementType select = SMDSAbs_All, avoid = SMDSAbs_Volume;
- getPreviewMesh( SMDSAbs_Face )->Copy( elements, copyElements, select, avoid );
- workElements = & copyElements;
- MakeGroups = false;
+ TPreviewMesh * tmpMesh = getPreviewMesh();
+ tmpMesh->Copy( elemsNodes[0], copyElements[0], select, avoid );
+ tmpMesh->Copy( elemsNodes[1], copyElements[1], select, avoid );
+ workElements = & copyElements[0];
+ theMakeGroups = false;
}
::SMESH_MeshEditor::Extrusion_Error error;
-
- if ( SMESH_Mesh_i* aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( Path ))
- {
- // path as mesh
- SMDS_MeshNode* aNodeStart =
- (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(NodeStart);
- if ( !aNodeStart ) {
- Error = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
- return EmptyGr;
- }
- error = getEditor().ExtrusionAlongTrack( *workElements, &(aMeshImp->GetImpl()), aNodeStart,
- HasAngles, angles, LinearVariation,
- HasRefPoint, refPnt, MakeGroups );
- declareMeshModified( /*isReComputeSafe=*/true );
- }
- else if ( SMESH_subMesh_i* aSubMeshImp = SMESH::DownCast<SMESH_subMesh_i*>( Path ))
- {
- // path as submesh
- SMESH::SMESH_Mesh_ptr aPathMesh = aSubMeshImp->GetFather();
- aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( aPathMesh );
- SMDS_MeshNode* aNodeStart =
- (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(NodeStart);
- if ( !aNodeStart ) {
- Error = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
- return EmptyGr;
- }
- SMESH_subMesh* aSubMesh =
- aMeshImp->GetImpl().GetSubMeshContaining(aSubMeshImp->GetId());
- error = getEditor().ExtrusionAlongTrack( *workElements, aSubMesh, aNodeStart,
- HasAngles, angles, LinearVariation,
- HasRefPoint, refPnt, MakeGroups );
- declareMeshModified( /*isReComputeSafe=*/true );
- }
- else if ( SMESH::DownCast<SMESH_Group_i*>( Path ))
- {
- // path as group of 1D elements
- // ????????
- }
+ if ( !aSubMesh )
+ error = getEditor().ExtrusionAlongTrack( workElements, &(aMeshImp->GetImpl()), nodeStart,
+ theHasAngles, angles, theLinearVariation,
+ theHasRefPoint, refPnt, theMakeGroups );
else
- {
- // invalid path
- Error = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
- return EmptyGr;
- }
+ error = getEditor().ExtrusionAlongTrack( workElements, aSubMesh, nodeStart,
+ theHasAngles, angles, theLinearVariation,
+ theHasRefPoint, refPnt, theMakeGroups );
- Error = convExtrError( error );
+ declareMeshModified( /*isReComputeSafe=*/true );
+ theError = convExtrError( error );
- if ( MakeGroups ) {
+ TPythonDump aPythonDump; // it is here to prevent dump of getGroups()
+ if ( theMakeGroups ) {
list<int> groupIDs = myMesh->GetGroupIds();
list<int>::iterator newBegin = groupIDs.begin();
std::advance( newBegin, nbOldGroups ); // skip old groups
groupIDs.erase( groupIDs.begin(), newBegin );
- return getGroups( & groupIDs );
+ aGroups = getGroups( & groupIDs );
+ if ( ! &aGroups.in() ) aGroups = new SMESH::ListOfGroups;
}
- return EmptyGr;
-
- SMESH_CATCH( SMESH::throwCorbaException );
- return 0;
-}
-
-//=======================================================================
-//function : ExtrusionAlongPath
-//purpose :
-//=======================================================================
-
-SMESH::SMESH_MeshEditor::Extrusion_Error
-SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array & theIDsOfElements,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array & theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct & theRefPoint)
- throw (SALOME::SALOME_Exception)
-{
- MESSAGE("ExtrusionAlongPath");
- if ( !myIsPreviewMode ) {
- TPythonDump() << "error = " << this << ".ExtrusionAlongPath( "
- << theIDsOfElements << ", "
- << thePathMesh << ", "
- << thePathShape << ", "
- << theNodeStart << ", "
- << theHasAngles << ", "
- << theAngles << ", "
- << theHasRefPoint << ", "
- << "SMESH.PointStruct( "
- << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
- }
- SMESH::SMESH_MeshEditor::Extrusion_Error anError;
- extrusionAlongPath( theIDsOfElements,
- thePathMesh,
- thePathShape,
- theNodeStart,
- theHasAngles,
- theAngles,
- theHasRefPoint,
- theRefPoint,
- false,
- anError);
- return anError;
-}
-
-//=======================================================================
-//function : ExtrusionAlongPathObject
-//purpose :
-//=======================================================================
-
-SMESH::SMESH_MeshEditor::Extrusion_Error
-SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array & theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct & theRefPoint)
- throw (SALOME::SALOME_Exception)
-{
- if ( !myIsPreviewMode ) {
- TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject( "
- << theObject << ", "
- << thePathMesh << ", "
- << thePathShape << ", "
- << theNodeStart << ", "
- << theHasAngles << ", "
- << theAngles << ", "
- << theHasRefPoint << ", "
- << "SMESH.PointStruct( "
- << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
- }
- SMESH::SMESH_MeshEditor::Extrusion_Error anError;
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- extrusionAlongPath( anElementsId,
- thePathMesh,
- thePathShape,
- theNodeStart,
- theHasAngles,
- theAngles,
- theHasRefPoint,
- theRefPoint,
- false,
- anError);
- return anError;
-}
-
-//=======================================================================
-//function : ExtrusionAlongPathObject1D
-//purpose :
-//=======================================================================
-
-SMESH::SMESH_MeshEditor::Extrusion_Error
-SMESH_MeshEditor_i::ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array & theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct & theRefPoint)
- throw (SALOME::SALOME_Exception)
-{
- if ( !myIsPreviewMode ) {
- TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject1D( "
- << theObject << ", "
- << thePathMesh << ", "
- << thePathShape << ", "
- << theNodeStart << ", "
- << theHasAngles << ", "
- << theAngles << ", "
- << theHasRefPoint << ", "
- << "SMESH.PointStruct( "
- << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
- }
- SMESH::SMESH_MeshEditor::Extrusion_Error anError;
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- extrusionAlongPath( anElementsId,
- thePathMesh,
- thePathShape,
- theNodeStart,
- theHasAngles,
- theAngles,
- theHasRefPoint,
- theRefPoint,
- false,
- anError,
- SMDSAbs_Edge);
- return anError;
-}
-//=======================================================================
-//function : ExtrusionAlongPathObject2D
-//purpose :
-//=======================================================================
-
-SMESH::SMESH_MeshEditor::Extrusion_Error
-SMESH_MeshEditor_i::ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array & theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct & theRefPoint)
- throw (SALOME::SALOME_Exception)
-{
if ( !myIsPreviewMode ) {
- TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject2D( "
- << theObject << ", "
- << thePathMesh << ", "
- << thePathShape << ", "
- << theNodeStart << ", "
- << theHasAngles << ", "
- << theAngles << ", "
- << theHasRefPoint << ", "
- << "SMESH.PointStruct( "
- << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
- }
- SMESH::SMESH_MeshEditor::Extrusion_Error anError;
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- extrusionAlongPath( anElementsId,
- thePathMesh,
- thePathShape,
- theNodeStart,
- theHasAngles,
- theAngles,
- theHasRefPoint,
- theRefPoint,
- false,
- anError,
- SMDSAbs_Face);
- return anError;
-}
-
-
-//=======================================================================
-//function : ExtrusionAlongPathMakeGroups
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups*
-SMESH_MeshEditor_i::ExtrusionAlongPathMakeGroups(const SMESH::long_array& theIDsOfElements,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array& theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct& theRefPoint,
- SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- SMESH::ListOfGroups * aGroups = extrusionAlongPath( theIDsOfElements,
- thePathMesh,
- thePathShape,
- theNodeStart,
- theHasAngles,
- theAngles,
- theHasRefPoint,
- theRefPoint,
- true,
- Error);
- if (!myIsPreviewMode) {
- bool isDumpGroups = aGroups && aGroups->length() > 0;
- if (isDumpGroups)
- aPythonDump << "(" << aGroups << ", error)";
- else
- aPythonDump <<"error";
-
- aPythonDump<<" = "<< this << ".ExtrusionAlongPathMakeGroups( "
- << theIDsOfElements << ", "
- << thePathMesh << ", "
- << thePathShape << ", "
- << theNodeStart << ", "
- << theHasAngles << ", "
- << theAngles << ", "
- << theHasRefPoint << ", "
- << "SMESH.PointStruct( "
- << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
- }
- return aGroups;
-}
-
-//=======================================================================
-//function : ExtrusionAlongPathObjectMakeGroups
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups* SMESH_MeshEditor_i::
-ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array& theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct& theRefPoint,
- SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
- thePathMesh,
- thePathShape,
- theNodeStart,
- theHasAngles,
- theAngles,
- theHasRefPoint,
- theRefPoint,
- true,
- Error);
-
- if (!myIsPreviewMode) {
- bool isDumpGroups = aGroups && aGroups->length() > 0;
- if (isDumpGroups)
- aPythonDump << "(" << aGroups << ", error)";
- else
- aPythonDump <<"error";
-
- aPythonDump << " = " << this << ".ExtrusionAlongPathObjectMakeGroups( "
- << theObject << ", "
- << thePathMesh << ", "
- << thePathShape << ", "
- << theNodeStart << ", "
- << theHasAngles << ", "
- << theAngles << ", "
- << theHasRefPoint << ", "
- << "SMESH.PointStruct( "
- << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
- }
- return aGroups;
-}
-
-//=======================================================================
-//function : ExtrusionAlongPathObject1DMakeGroups
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups* SMESH_MeshEditor_i::
-ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array& theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct& theRefPoint,
- SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
- thePathMesh,
- thePathShape,
- theNodeStart,
- theHasAngles,
- theAngles,
- theHasRefPoint,
- theRefPoint,
- true,
- Error,
- SMDSAbs_Edge);
-
- if (!myIsPreviewMode) {
- bool isDumpGroups = aGroups && aGroups->length() > 0;
- if (isDumpGroups)
- aPythonDump << "(" << aGroups << ", error)";
- else
- aPythonDump << "error";
-
- aPythonDump << " = " << this << ".ExtrusionAlongPathObject1DMakeGroups( "
- << theObject << ", "
- << thePathMesh << ", "
- << thePathShape << ", "
- << theNodeStart << ", "
- << theHasAngles << ", "
- << theAngles << ", "
- << theHasRefPoint << ", "
- << "SMESH.PointStruct( "
- << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
- }
- return aGroups;
-}
-
-//=======================================================================
-//function : ExtrusionAlongPathObject2DMakeGroups
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups* SMESH_MeshEditor_i::
-ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
- SMESH::SMESH_Mesh_ptr thePathMesh,
- GEOM::GEOM_Object_ptr thePathShape,
- CORBA::Long theNodeStart,
- CORBA::Boolean theHasAngles,
- const SMESH::double_array& theAngles,
- CORBA::Boolean theHasRefPoint,
- const SMESH::PointStruct& theRefPoint,
- SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
- throw (SALOME::SALOME_Exception)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- prepareIdSource( theObject );
- SMESH::long_array_var anElementsId = theObject->GetIDs();
- SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
- thePathMesh,
- thePathShape,
- theNodeStart,
- theHasAngles,
- theAngles,
- theHasRefPoint,
- theRefPoint,
- true,
- Error,
- SMDSAbs_Face);
-
- if (!myIsPreviewMode) {
- bool isDumpGroups = aGroups && aGroups->length() > 0;
- if (isDumpGroups)
- aPythonDump << "(" << aGroups << ", error)";
- else
- aPythonDump << "error";
-
- aPythonDump << " = " << this << ".ExtrusionAlongPathObject2DMakeGroups( "
- << theObject << ", "
- << thePathMesh << ", "
- << thePathShape << ", "
- << theNodeStart << ", "
- << theHasAngles << ", "
- << theAngles << ", "
- << theHasRefPoint << ", "
+ aPythonDump << "(" << aGroups << ", error) = "
+ << this << ".ExtrusionAlongPathObjects( "
+ << theNodes << ", "
+ << theEdges << ", "
+ << theFaces << ", "
+ << thePathMesh << ", "
+ << thePathShape << ", "
+ << theNodeStart << ", "
+ << theHasAngles << ", "
+ << theAngles << ", "
+ << theLinearVariation << ", "
+ << theHasRefPoint << ", "
<< "SMESH.PointStruct( "
<< ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
<< ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
- << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
- }
- return aGroups;
-}
-
-//=======================================================================
-//function : ExtrusionAlongPathObjX
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups* SMESH_MeshEditor_i::
-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)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
-
- prepareIdSource( Object );
- SMESH::long_array_var anElementsId = Object->GetIDs();
- SMESH::ListOfGroups * aGroups = extrusionAlongPathX(anElementsId,
- Path,
- NodeStart,
- HasAngles,
- Angles,
- LinearVariation,
- HasRefPoint,
- RefPoint,
- MakeGroups,
- (SMDSAbs_ElementType)ElemType,
- Error);
-
- if (!myIsPreviewMode) {
- bool isDumpGroups = aGroups && aGroups->length() > 0;
- if (isDumpGroups)
- aPythonDump << "(" << *aGroups << ", error)";
- else
- aPythonDump << "error";
-
- aPythonDump << " = " << this << ".ExtrusionAlongPathObjX( "
- << Object << ", "
- << Path << ", "
- << NodeStart << ", "
- << HasAngles << ", "
- << TVar( Angles ) << ", "
- << LinearVariation << ", "
- << HasRefPoint << ", "
- << "SMESH.PointStruct( "
- << TVar( HasRefPoint ? RefPoint.x : 0 ) << ", "
- << TVar( HasRefPoint ? RefPoint.y : 0 ) << ", "
- << TVar( HasRefPoint ? RefPoint.z : 0 ) << " ), "
- << MakeGroups << ", "
- << ElemType << " )";
+ << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ))";
}
- return aGroups;
-}
-
-//=======================================================================
-//function : ExtrusionAlongPathX
-//purpose :
-//=======================================================================
-
-SMESH::ListOfGroups* SMESH_MeshEditor_i::
-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)
-{
- TPythonDump aPythonDump; // it is here to prevent dump of GetGroups()
- SMESH::ListOfGroups * aGroups = extrusionAlongPathX(IDsOfElements,
- Path,
- NodeStart,
- HasAngles,
- Angles,
- LinearVariation,
- HasRefPoint,
- RefPoint,
- MakeGroups,
- (SMDSAbs_ElementType)ElemType,
- Error);
+ return aGroups._retn();
- if (!myIsPreviewMode) {
- bool isDumpGroups = aGroups && aGroups->length() > 0;
- if (isDumpGroups)
- aPythonDump << "(" << *aGroups << ", error)";
- else
- aPythonDump <<"error";
-
- aPythonDump << " = " << this << ".ExtrusionAlongPathX( "
- << IDsOfElements << ", "
- << Path << ", "
- << NodeStart << ", "
- << HasAngles << ", "
- << TVar( Angles ) << ", "
- << LinearVariation << ", "
- << HasRefPoint << ", "
- << "SMESH.PointStruct( "
- << TVar( HasRefPoint ? RefPoint.x : 0 ) << ", "
- << TVar( HasRefPoint ? RefPoint.y : 0 ) << ", "
- << TVar( HasRefPoint ? RefPoint.z : 0 ) << " ), "
- << MakeGroups << ", "
- << ElemType << " )";
- }
- return aGroups;
+ SMESH_CATCH( SMESH::throwCorbaException );
+ return 0;
}
//================================================================================
bool emptyIfIsMesh = myIsPreviewMode ? false : true;
- prepareIdSource( theObject );
if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
mirror(elements, theAxis, theMirrorType, theCopy, false);
}
SMESH::ListOfGroups * aGroups = 0;
TIDSortedElemSet elements;
- prepareIdSource( theObject );
if ( idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
aGroups = mirror(elements, theMirror, theMirrorType, true, true);
mesh = makeMesh( theMeshName );
mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
TIDSortedElemSet elements;
- prepareIdSource( theObject );
if ( mesh_i &&
idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
{
TIDSortedElemSet elements;
bool emptyIfIsMesh = myIsPreviewMode ? false : true;
-
- prepareIdSource( theObject );
+
if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
translate(elements, theVector, theCopy, false);
}
SMESH::ListOfGroups * aGroups = 0;
TIDSortedElemSet elements;
- prepareIdSource( theObject );
if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
aGroups = translate(elements, theVector, true, true);
mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
TIDSortedElemSet elements;
- prepareIdSource( theObject );
if ( mesh_i &&
- idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
+ idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
{
translate(elements, theVector,false, theCopyGroups, & mesh_i->GetImpl());
mesh_i->CreateGroupServants();
}
TIDSortedElemSet elements;
bool emptyIfIsMesh = myIsPreviewMode ? false : true;
- prepareIdSource( theObject );
if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
rotate(elements,theAxis,theAngle,theCopy,false);
}
SMESH::ListOfGroups * aGroups = 0;
TIDSortedElemSet elements;
- prepareIdSource( theObject );
if (idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
aGroups = rotate(elements, theAxis, theAngle, true, true);
mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
TIDSortedElemSet elements;
- prepareIdSource( theObject );
if (mesh_i &&
idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
{
theCopy = false;
TIDSortedElemSet elements;
- prepareIdSource( theObject );
bool emptyIfIsMesh = myIsPreviewMode ? false : true;
if ( !idSourceToSet(theObject, getMeshDS(), elements, SMDSAbs_All, emptyIfIsMesh))
return 0;
initData();
TIDSortedNodeSet nodes;
- prepareIdSource( theObject );
idSourceToNodeSet( theObject, getMeshDS(), nodes );
::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
initData();
TIDSortedNodeSet nodes;
- prepareIdSource( theObject );
idSourceToNodeSet( theObject, getMeshDS(), nodes );
for ( int i = 0; i < theExceptSubMeshOrGroups.length(); ++i )
if ( !(!group->_is_nil() && group->GetType() == SMESH::NODE) )
{
TIDSortedElemSet elems;
- prepareIdSource( theObject );
idSourceToSet( theObject, getMeshDS(), elems, SMDSAbs_All, /*emptyIfIsMesh=*/true);
::SMESH_MeshEditor::TListOfListOfElementsID aListOfListOfElementsID;
bool elemsOK;
if ( !( elemsOK = CORBA::is_nil( theObject )))
{
- prepareIdSource( theObject );
elemsOK = idSourceToSet( theObject, getMeshDS(), elems,
SMDSAbs_All, /*emptyIfIsMesh=*/true );
}
TPythonDump pyDump;
TIDSortedElemSet elems;
- prepareIdSource( theObject );
if ( idSourceToSet( theObject, getMeshDS(), elems, SMDSAbs_All, /*emptyIfIsMesh=*/true ))
{
if ( elems.empty() )
filter->SetMesh( mesh );
}
}
+//================================================================================
+/*!
+ * \brief Retrieve elements of given type from SMESH_IDSource
+ */
+//================================================================================
+
+bool SMESH_MeshEditor_i::idSourceToSet(SMESH::SMESH_IDSource_ptr theIDSource,
+ const SMESHDS_Mesh* theMeshDS,
+ TIDSortedElemSet& theElemSet,
+ const SMDSAbs_ElementType theType,
+ const bool emptyIfIsMesh,
+ IDSource_Error* error)
+
+{
+ if ( error ) *error = IDSource_OK;
+
+ if ( CORBA::is_nil( theIDSource ) )
+ {
+ if ( error ) *error = IDSource_INVALID;
+ return false;
+ }
+ if ( emptyIfIsMesh && SMESH::DownCast<SMESH_Mesh_i*>( theIDSource ))
+ {
+ if ( error && getMeshDS()->GetMeshInfo().NbElements( theType ) == 0 )
+ *error = IDSource_EMPTY;
+ return true;
+ }
+ prepareIdSource( theIDSource );
+ SMESH::long_array_var anIDs = theIDSource->GetIDs();
+ if ( anIDs->length() == 0 )
+ {
+ if ( error ) *error = IDSource_EMPTY;
+ return false;
+ }
+ SMESH::array_of_ElementType_var types = theIDSource->GetTypes();
+ if ( types->length() == 1 && types[0] == SMESH::NODE ) // group of nodes
+ {
+ if ( theType == SMDSAbs_All || theType == SMDSAbs_Node )
+ {
+ arrayToSet( anIDs, getMeshDS(), theElemSet, SMDSAbs_Node );
+ }
+ else
+ {
+ if ( error ) *error = IDSource_INVALID;
+ return false;
+ }
+ }
+ else
+ {
+ arrayToSet( anIDs, getMeshDS(), theElemSet, theType);
+ if ( bool(anIDs->length()) != bool(theElemSet.size()))
+ {
+ if ( error ) *error = IDSource_INVALID;
+ return false;
+ }
+ }
+ return true;
+}
//================================================================================
/*!
- * \brief Duplicates given elements, i.e. creates new elements based on the
+ * \brief Duplicates given elements, i.e. creates new elements based on the
* same nodes as the given ones.
* \param theElements - container of elements to duplicate.
* \param theGroupName - a name of group to contain the generated elements.
TPythonDump pyDump;
TIDSortedElemSet elems;
- prepareIdSource( theElements );
if ( idSourceToSet( theElements, getMeshDS(), elems, SMDSAbs_All, /*emptyIfIsMesh=*/true))
{
getEditor().DoubleElements( elems );
TIDSortedElemSet elements;
SMDSAbs_ElementType elemType = (dim == SMESH::BND_1DFROM2D) ? SMDSAbs_Face : SMDSAbs_Volume;
- prepareIdSource( idSource );
if ( idSourceToSet( idSource, aMeshDS, elements, elemType,/*emptyIfIsMesh=*/true ))
{
// mesh to fill in
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)
- 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)
- throw (SALOME::SALOME_Exception);
-
- void ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
- const SMESH::DirStruct & StepVector,
- CORBA::Long NbOfSteps)
- 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* 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);
+
+ 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);
+
+ 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);
+
+ 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,
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)
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,
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;
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()
}
myInfo = tmpInfo;
+ ShapeToMesh( _meshDS->ShapeToMesh() );
+
_meshDS = 0; // to enforce iteration on _elements and _nodes
}
}
# 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
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)
# @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)
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.
# @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)
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.
# @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)
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.
# @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)
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 elements with given ids
- # @param IDsOfElements the list of elements ids for extrusion
+ ## 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
- # @param IsNodes is True if elements with given ids are nodes
# @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
# @ingroup l2_modif_extrurev
- def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False, IsNodes = False):
- if IDsOfElements == []:
- IDsOfElements = self.GetElementsId()
+ 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)
- 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 []
+
+ return self.editor.ExtrusionSweepObjects( nodes, edges, faces, StepVector, NbOfSteps, MakeGroups)
+
## Generates new elements by extrusion of the elements with given ids
- # @param IDsOfElements is ids of elements
+ # @param IDsOfElements the list of elements ids for extrusion
# @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
+ # @param IsNodes is True if elements with given ids are nodes
+ # @return the 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)):
+ def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False, IsNodes = False):
+ if IDsOfElements == []:
+ 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 ):
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 []
+ NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
+ Parameters = StepVector.PS.parameters + var_separator + Parameters
+ self.mesh.SetParameters(Parameters)
+ 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.
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,
# 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.
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.
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.
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)
+ if Base:
+ Base = self.GetIDSource( Base, ElemType )
+ unRegister.set( Base )
+ else:
+ Base = self.mesh
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,
+ 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, ElemType)
- else:
- raise RuntimeError, "Invalid Base for ExtrusionAlongPathX"
+ 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
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
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.
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.
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
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)
# @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)