23620: EDF 10301 - Completing Extrusion along a path

Add scale factors to Extrusion along line
Add angles to Extrusion along path
This commit is contained in:
eap 2019-01-24 18:28:24 +03:00
parent 69119810f6
commit 401b2a2e54
32 changed files with 1085 additions and 1094 deletions

View File

@ -1,5 +1,7 @@
# Extrusion
# There is a series of Extrusion Along Line methods added at different times;
# a fully functional method is ExtrusionSweepObjects()
import salome, math
salome.salome_init()
@ -48,22 +50,13 @@ stepVector = [0.,0.,1.]
mesh.ExtrusionSweepObject1D( obj, stepVector, nbSteps )
# extrude a group
lineExtruded = None
for g in mesh.GetGroups( SMESH.FACE ):
if g.GetName() == "line_extruded":
lineExtruded = g
break
obj = lineExtruded
obj = mesh.GetGroupByName( "line_extruded", SMESH.FACE )[0]
stepVector = [0,-5.,0.]
nbSteps = 1
mesh.ExtrusionSweepObject( obj, stepVector, nbSteps )
# extrude all nodes and triangle faces of the disk quarter, applying a scale factor
diskGroup = None
for g in mesh.GetGroups( SMESH.FACE ):
if g.GetName() == "line_rotated":
diskGroup = g
break
diskGroup = mesh.GetGroupByName( "line_rotated", SMESH.FACE )[0]
crit = [ smesh.GetCriterion( SMESH.FACE, SMESH.FT_ElemGeomType,'=',SMESH.Geom_TRIANGLE ),
smesh.GetCriterion( SMESH.FACE, SMESH.FT_BelongToMeshGroup,'=', diskGroup )]
trianglesFilter = smesh.GetFilterFromCriteria( crit )

View File

@ -19,7 +19,7 @@ iv = 1
vertices = []
for point in points:
vert = geompy.MakeVertex(point[0], point[1], 0)
geompy.addToStudy(vert, "Vertex_" + repr(iv))
#geompy.addToStudy(vert, "Vertex_" + repr(iv))
vertices.append(vert)
iv += 1
pass
@ -97,8 +97,8 @@ Edge_Circle_mesh = Mesh1D(Edge_Circle , 8, "Edge_Circle" , smesh_builder=sme
# IDsOfElements, PathMesh, PathShape, NodeStart,
# HasAngles, Angles, HasRefPoint, RefPoint
refPoint = SMESH.PointStruct(0, 0, 0)
a10 = 10.0*math.pi/180.0
a45 = 45.0*math.pi/180.0
a10 = math.radians( 10.0 )
a45 = math.radians( 45.0 )
# 1. Extrusion of two mesh edges along a straight path
error = quad_1.ExtrusionAlongPath([1,2], Edge_straight_mesh, Edge_straight, 1,
@ -128,4 +128,53 @@ error = quad_6.ExtrusionAlongPath(ff_6 , Edge_Circle_mesh, Edge_Circle, 1,
error = quad_7.ExtrusionAlongPath(ff_7, Edge_Circle_mesh, Edge_Circle, 1,
1, [a45, -a45, a45, -a45, a45, -a45, a45, -a45], 0, refPoint)
# Make the same meshes using a fully functional method ExtrusionAlongPathObjects() having
# the following arguments:
# Nodes, Edges, Faces, PathObject, PathShape=None,
# NodeStart=1, HasAngles=False, Angles=[], LinearVariation=False,
# HasRefPoint=False, RefPoint=[0,0,0], MakeGroups=False,
# ScaleFactors=[], ScalesVariation=False
quad_1 = MakeQuadMesh2("quad_1", smesh_builder=smesh)[0]
quad_2 = MakeQuadMesh2("quad_2", smesh_builder=smesh)[0]
quad_3 = MakeQuadMesh2("quad_3", smesh_builder=smesh)[0]
quad_4 = MakeQuadMesh2("quad_4", smesh_builder=smesh)[0]
quad_5 = MakeQuadMesh2("quad_5", smesh_builder=smesh)[0]
quad_6 = MakeQuadMesh2("quad_6", smesh_builder=smesh)[0]
quad_7 = MakeQuadMesh2("quad_7", smesh_builder=smesh)[0]
# 1. Extrusion of two mesh edges along a straight path
nn, ee, ff = [], [1,2], []
error = quad_1.ExtrusionAlongPathObjects( nn, ee, ff, Edge_straight_mesh )
# 2. Extrusion of one mesh edge along a curved path
nn, ee, ff = [], [2], []
error = quad_2.ExtrusionAlongPathObjects( nn, ee, ff, Edge_bezierrr_mesh )
# 3. Extrusion of one mesh edge along a curved path with usage of angles
error = quad_3.ExtrusionAlongPathObjects( nn, ee, ff, Edge_bezierrr_mesh,
Angles=[a45, a45, a45, 0, -a45, -a45, -a45])
# 4. Extrusion of one mesh edge along the path, which is a part of a meshed wire
nn, ee, ff = [], [4], []
error = quad_4.ExtrusionAlongPathObjects( nn, ee, ff, Wire_polyline_mesh, Wire_polyline_edges[0],
Angles=[a10, a10, a10])
# 5. Extrusion of two mesh faces along the path, which is a part of a meshed wire
nn, ee, ff = [], [], quad_5
error = quad_5.ExtrusionAlongPathObjects( nn, ee, ff, Wire_polyline_mesh, Wire_polyline_edges[2],
NodeStart=4 )
# 6. Extrusion of two mesh faces along a closed path
nn, ee, ff = [], [], quad_6
error = quad_6.ExtrusionAlongPathObjects( nn, ee, ff, Edge_Circle_mesh )
# 7. Extrusion of two mesh faces along a closed path with usage of angles
nn, ee, ff = [], [], quad_7
error = quad_7.ExtrusionAlongPathObjects( nn, ee, ff, Edge_Circle_mesh, Edge_Circle,
Angles=[a45, -a45, a45, -a45, a45, -a45, a45, -a45])
salome.sg.updateObjBrowser()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -63,10 +63,10 @@ When 2D elements are extruded, in addition to 3D elements segments are created o
* Input the element IDs directly in **Node IDs**, **Edge IDs** and **Face IDs** fields. The selected elements will be highlighted in the viewer, if the mesh is shown there.
* Apply Filters. **Set filter** button allows to apply a filter to the selection of elements. See more about filters in the :ref:`filtering_elements` page.
* If the **Extrusion to Distance** radio button is selected
* If the **Extrusion to distance** radio button is selected
* specify the translation vector by which the elements will be extruded.
* If the **Extrusion Along Vector** radio button is selected
* If the **Extrusion along vector** radio button is selected
.. image:: ../images/extrusionalongaline2.png
:align: center
@ -76,7 +76,7 @@ When 2D elements are extruded, in addition to 3D elements segments are created o
* If the **Extrusion By Normal** radio button is selected, every node of the selected faces is extruded along the *average* of the *normal* vectors to the faces sharing the node. (Nodes and edges cannot be extruded in this mode.)
* If the **Extrusion by normal** radio button is selected, every node of the selected faces is extruded along the *average* of the *normal* vectors to the faces sharing the node. (Nodes and edges cannot be extruded in this mode.)
.. image:: ../images/extrusionalongaline3.png
:align: center
@ -115,11 +115,15 @@ When 2D elements are extruded, in addition to 3D elements segments are created o
* Specify the **Number of steps**.
* Optionally specify **Scale Factors**. Each scale factor in the list is applied to nodes of a corresponding extrusion step unless **Linear Variation of Scale Factors** is checked, is which case the scale factors are spread over all extrusion steps.
* **Scaling Center** can be defined either using spin boxes or by picking a node in the Viewer or by picking a geometrical vertex in the Object Browser.
* Optionally specify **Scale factors**. Each scale factor in the list is applied to nodes of a corresponding extrusion step unless **Linear variation of factors** is checked, is which case the scale factors are spread over all extrusion steps.
* **Base point** serving as a scaling canter can be defined either using spin boxes or by picking a node in the Viewer or by picking a geometrical vertex in the Object Browser.
* **Add** button |add| adds a scale factor to the list.
* **Remove** button |rm| removes selected scale factors from the list.
* The elements can also be rotated around the **Base point** to get the resulting mesh in a helical fashion. You can set the values of **Rotation angles** to the list by pressing the *"Add"* button |add| and remove them from the list by pressing the *"Remove"* button |rm|.
**Linear variation of angles** option allows defining the angle of gradual rotation for the whole path. At each step the elements will be rotated by *( angle / nb. of steps )*.
* If you activate **Generate Groups** check-box, the *result elements* created from *selected elements* 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 *g_Faces* group (see figures below) then result hexahedra will be included in *g_Faces_extruded* group and a quadrangle created at the "top" of extruded mesh will be included in *g_Faces_top group*.
.. image:: ../images/extrusion_groups.png

View File

@ -123,7 +123,7 @@ Extrusion of 2d elements along a closed path
* **Start node** - the start node of the Path. It is used to define the direction of extrusion.
* If you activate **Generate Groups** check-box, the **result elements** created from **selected elements** 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 *g_Faces* group (see figures below) then result hexahedra will be included in *g_Faces_extruded* group and a quadrangle created at the "top" of extruded mesh will be included in *g_Faces_top group*.
* If you activate **Generate groups** check-box, the *result elements* created from *selected elements* 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 *g_Faces* group (see figures below) then result hexahedra will be included in *g_Faces_extruded* group and a quadrangle created at the "top" of extruded mesh will be included in *g_Faces_top group*.
.. image:: ../images/extrusion_groups.png
:align: center
@ -138,16 +138,18 @@ Extrusion of 2d elements along a closed path
#. There are two optional parameters, which can be very useful:
* 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 **Base Point** around which the elements are rotated is the mass center of the elements (note that it can differ from the gravity center computed by *Geometry* module for the underlying shape), however, you can specify any point as the **Base Point** and the elements will be rotated with respect to this point. Note that only the displacement of the **Base Point** exactly equals to the path, and all other extruded elements simply keep their position relatively to the **Base Point** at each iteration.
* 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 **Base point** around which the elements are rotated is the mass center of the elements (note that it can differ from the gravity center computed by *Geometry* module for the underlying shape), however, you can specify any point as the **Base point** and the elements will be rotated with respect to this point. Note that only the displacement of the **Base point** exactly equals to the path, and all other extruded elements simply keep their position relatively to the **Base point** at each iteration.
.. |add| image:: ../images/add.png
.. |rem| image:: ../images/remove.png
* 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 *"Add"* button |add| and remove them from the list by pressing the *"Remove"* button |rem|.
* The elements can also be rotated around the path with rotaion center at the **Base point** to get the resulting mesh in a helical fashion. You can set the values of angles at the right, add them to **Rotation angles** list at the left by pressing the *"Add"* button |add| and remove them from the list by pressing the *"Remove"* button |rem|.
**Linear variation of angles** option allows defining the angle of gradual rotation for the whole path. At each step the elements will be rotated by *( angle / nb. of steps )*.
**Linear variation of the angles** option allows defining the angle of gradual rotation for the whole path. At each step the elements will be rotated by *( angle / nb. of steps )*.
* Each of optional **Scale factors** in the list is applied to nodes of a corresponding extrusion step unless **Linear variation of factors** is checked, is which case the scale factors are spread over all extrusion steps. **Base point** serves as a scaling canter.
* *"Add"* button |add| adds a scale factor to the list.
* *"Remove"* button |rem| removes selected scale factors from the list.
#. Click **Apply** or **Apply and Close** 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.

View File

@ -510,13 +510,21 @@ module SMESH
/*!
* \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 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.
* \param scaleFactors - optional scale factors to apply during extrusion; it's
* usage depends on \a scalesVariation parameter.
* \param scalesVariation - if \c True, \a scaleFactors are spread over all \a NbOfSteps,
otherwise \a scaleFactors[i] is applied to nodes at the i-th extrusion step.
* \param angles - optional rotation angles to apply during extrusion; it's
* usage depends on \a anglesVariation parameter.
* \param anglesVariation - if \c True, \a angles are spread over all \a NbOfSteps,
otherwise \a angle[i] is applied to nodes at the i-th extrusion step.
* \return ListOfGroups - new groups created if \a toMakeGroups is true
*/
ListOfGroups ExtrusionSweepObjects(in ListOfIDSources nodes,
@ -524,10 +532,12 @@ module SMESH
in ListOfIDSources faces,
in DirStruct stepVector,
in long nbOfSteps,
in boolean toMakeGroups,
in double_array scaleFactors,
in boolean linearVariation,
in boolean scaleVariation,
in double_array basePoint,
in boolean toMakeGroups)
in double_array angles,
in boolean angleVariation)
raises (SALOME::SALOME_Exception);
/*! Generates new elements by extrusion along the normal to a discretized surface or wire
@ -569,18 +579,20 @@ module SMESH
EXTR_CANT_GET_TANGENT
};
ListOfGroups ExtrusionAlongPathObjects(in ListOfIDSources Nodes,
in ListOfIDSources Edges,
in ListOfIDSources Faces,
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 AnglesVariation,
in boolean HasRefPoint,
in PointStruct RefPoint,
in boolean MakeGroups,
in double_array ScaleFactors,
in boolean ScaleVariation,
out Extrusion_Error Error)
raises (SALOME::SALOME_Exception);

File diff suppressed because it is too large Load Diff

View File

@ -297,6 +297,7 @@ public:
* USE_INPUT_ELEMS_ONLY: to use only input elements to compute extrusion direction
* for ExtrusionByNormal()
* SCALE_LINEAR_VARIATION: to make linear variation of scale factors
* ANGLE_LINEAR_VARIATION: to make linear variation of angles
*/
enum ExtrusionFlags {
EXTRUSION_FLAG_BOUNDARY = 0x01,
@ -304,7 +305,8 @@ public:
EXTRUSION_FLAG_GROUPS = 0x04,
EXTRUSION_FLAG_BY_AVG_NORMAL = 0x08,
EXTRUSION_FLAG_USE_INPUT_ELEMS_ONLY = 0x10,
EXTRUSION_FLAG_SCALE_LINEAR_VARIATION = 0x20
EXTRUSION_FLAG_SCALE_LINEAR_VARIATION = 0x20,
EXTRUSION_FLAG_ANGLE_LINEAR_VARIATION = 0x40
};
/*!
@ -312,24 +314,20 @@ public:
*/
class SMESH_EXPORT ExtrusParam
{
gp_Dir myDir; // direction of extrusion
Handle(TColStd_HSequenceOfReal) mySteps; // magnitudes for each step
std::vector<double> myScales, myMediumScales;// scale factors
gp_XYZ myBaseP; // scaling center
SMESH_SequenceOfNode myNodes; // nodes for using in sewing
int myFlags; // see ExtrusionFlags
double myTolerance; // tolerance for sewing nodes
const TIDSortedElemSet* myElemsToUse; // elements to use for extrusion by normal
int (ExtrusParam::*myMakeNodesFun)(SMESHDS_Mesh* mesh,
const SMDS_MeshNode* srcNode,
std::list<const SMDS_MeshNode*> & newNodes,
const bool makeMediumNodes);
public:
//! Point on extrusion path
struct PathPoint
{
gp_Pnt myPnt;
gp_Dir myTgt;
double myAngle, myScale;
PathPoint(): myPnt(99., 99., 99.), myTgt(1.,0.,0.), myAngle(0), myScale(0) {}
};
ExtrusParam( const gp_Vec& theStep,
const int theNbSteps,
const std::list<double>& theScales,
const std::list<double>& theAngles,
const gp_XYZ* theBaseP,
const int theFlags = 0,
const double theTolerance = 1e-6);
@ -341,15 +339,21 @@ public:
const int theNbSteps,
const int theFlags,
const int theDim); // for extrusion by normal
ExtrusParam( const std::vector< PathPoint >& thePoints,
const gp_Pnt* theBaseP,
const std::list<double>& theScales,
const bool theMakeGroups); // for extrusion along path
SMESH_SequenceOfNode& ChangeNodes() { return myNodes; }
int& Flags() { return myFlags; }
bool ToMakeBoundary() const { return myFlags & EXTRUSION_FLAG_BOUNDARY; }
bool ToMakeGroups() const { return myFlags & EXTRUSION_FLAG_GROUPS; }
bool ToUseInpElemsOnly() const { return myFlags & EXTRUSION_FLAG_USE_INPUT_ELEMS_ONLY; }
bool IsLinearVariation() const { return myFlags & EXTRUSION_FLAG_SCALE_LINEAR_VARIATION; }
int NbSteps() const { return mySteps->Length(); }
bool IsScaleVariation() const { return myFlags & EXTRUSION_FLAG_SCALE_LINEAR_VARIATION; }
bool IsAngleVariation() const { return myFlags & EXTRUSION_FLAG_ANGLE_LINEAR_VARIATION; }
int NbSteps() const {
return mySteps.IsNull() ? myPathPoints.size() - 1: mySteps->Length();
}
// stores elements to use for extrusion by normal, depending on
// state of EXTRUSION_FLAG_USE_INPUT_ELEMS_ONLY flag;
// define myBaseP for scaling
@ -365,6 +369,20 @@ public:
}
private:
gp_Dir myDir; // direction of extrusion
Handle(TColStd_HSequenceOfReal) mySteps; // magnitudes for each step
std::vector<double> myScales;// scale factors
std::vector<double> myAngles;// angles
gp_XYZ myBaseP; // scaling/rotation center
SMESH_SequenceOfNode myNodes; // nodes for using in sewing
int myFlags; // see ExtrusionFlags
double myTolerance; // tolerance for sewing nodes
const TIDSortedElemSet* myElemsToUse; // elements to use for extrusion by normal
std::vector< PathPoint > myPathPoints; // points along a path
int (ExtrusParam::* myMakeNodesFun)(SMESHDS_Mesh*, // function of extrusion method
const SMDS_MeshNode*,
std::list<const SMDS_MeshNode*> &,
const bool);
int makeNodesByDir( SMESHDS_Mesh* mesh,
const SMDS_MeshNode* srcNode,
std::list<const SMDS_MeshNode*> & newNodes,
@ -381,6 +399,10 @@ public:
const SMDS_MeshNode* srcNode,
std::list<const SMDS_MeshNode*> & newNodes,
const bool makeMediumNodes);
int makeNodesAlongTrack( SMESHDS_Mesh* mesh,
const SMDS_MeshNode* srcNode,
std::list<const SMDS_MeshNode*> & newNodes,
const bool makeMediumNodes);
// step iteration
void beginStepIter( bool withMediumNodes );
bool moreSteps();
@ -438,24 +460,16 @@ public:
};
Extrusion_Error ExtrusionAlongTrack (TIDSortedElemSet theElements[2],
SMESH_subMesh* theTrackPattern,
SMESH_Mesh* theTrackMesh,
SMDS_ElemIteratorPtr theTrackIterator,
const SMDS_MeshNode* theNodeStart,
const bool theHasAngles,
std::list<double>& theAngles,
const bool theLinearVariation,
const bool theHasRefPoint,
const gp_Pnt& theRefPoint,
const bool theAngleVariation,
std::list<double>& theScales,
const bool theScaleVariation,
const gp_Pnt* theRefPoint,
const bool theMakeGroups);
Extrusion_Error ExtrusionAlongTrack (TIDSortedElemSet theElements[2],
SMESH_Mesh* theTrackPattern,
const SMDS_MeshNode* theNodeStart,
const bool theHasAngles,
std::list<double>& theAngles,
const bool theLinearVariation,
const bool theHasRefPoint,
const gp_Pnt& theRefPoint,
const bool theMakeGroups);
// Generate new elements by extrusion of theElements along path given by theTrackPattern,
// Generate new elements by extrusion of theElements along path given by theTrackIterator,
// theHasAngles are the rotation angles, base point can be given by theRefPoint
PGroupIDs Transform (TIDSortedElemSet & theElements,
@ -791,36 +805,10 @@ public:
const int nbSteps,
SMESH_SequenceOfElemPtr& srcElements);
struct SMESH_MeshEditor_PathPoint
{
gp_Pnt myPnt;
gp_Dir myTgt;
double myAngle, myPrm;
SMESH_MeshEditor_PathPoint(): myPnt(99., 99., 99.), myTgt(1.,0.,0.), myAngle(0), myPrm(0) {}
void SetPnt (const gp_Pnt& aP3D) { myPnt =aP3D; }
void SetTangent (const gp_Dir& aTgt) { myTgt =aTgt; }
void SetAngle (const double& aBeta) { myAngle=aBeta; }
void SetParameter(const double& aPrm) { myPrm =aPrm; }
const gp_Pnt& Pnt ()const { return myPnt; }
const gp_Dir& Tangent ()const { return myTgt; }
double Angle ()const { return myAngle; }
double Parameter ()const { return myPrm; }
};
Extrusion_Error makeEdgePathPoints(std::list<double>& aPrms,
const TopoDS_Edge& aTrackEdge,
bool aFirstIsStart,
std::list<SMESH_MeshEditor_PathPoint>& aLPP);
Extrusion_Error makeExtrElements(TIDSortedElemSet theElements[2],
std::list<SMESH_MeshEditor_PathPoint>& theFullList,
const bool theHasAngles,
std::list<double>& theAngles,
const bool theLinearVariation,
const bool theHasRefPoint,
const gp_Pnt& theRefPoint,
const bool theMakeGroups);
static void linearAngleVariation(const int NbSteps,
std::list<double>& theAngles);
static void linearScaleVariation(const int NbSteps,
std::list<double>& theScales);
bool doubleNodes( SMESHDS_Mesh* theMeshDS,
const TIDSortedElemSet& theElems,

View File

@ -36,6 +36,7 @@
#include "SMESH_HypoFilter.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MeshAlgos.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_ProxyMesh.hxx"
#include "SMESH_subMesh.hxx"
@ -73,7 +74,7 @@ using namespace std;
namespace {
inline SMESH_TNodeXYZ XYZ(const SMDS_MeshNode* n) { return SMESH_TNodeXYZ(n); }
inline SMESH_NodeXYZ XYZ(const SMDS_MeshNode* n) { return SMESH_NodeXYZ(n); }
enum { U_periodic = 1, V_periodic = 2 };
}
@ -1035,6 +1036,16 @@ double SMESH_MesherHelper::GetNodeU(const TopoDS_Edge& E,
int vertexID = n->getshapeId();
const TopoDS_Vertex& V = TopoDS::Vertex(meshDS->IndexToShape(vertexID));
param = BRep_Tool::Parameter( V, E );
if ( inEdgeNode )
{
BRepAdaptor_Curve curve( E );
if ( curve.IsPeriodic() )
{
double uInEdge = GetNodeU( E, inEdgeNode );
param += ShapeAnalysis::AdjustByPeriod( param, uInEdge, curve.Period() );
}
}
}
}
if ( check )

View File

@ -29,7 +29,8 @@
#include "SMESH_SMESH.hxx"
#include "SMESH_MeshEditor.hxx" // needed for many meshers
#include "SMESH_ComputeError.hxx"
#include "SMESH_TypeDefs.hxx"
#include <Geom_Surface.hxx>
#include <ShapeAnalysis_Surface.hxx>
@ -44,8 +45,15 @@ class GeomAPI_ProjectPointOnCurve;
class GeomAPI_ProjectPointOnSurf;
class SMDS_MeshNode;
class SMESHDS_Hypothesis;
class SMESHDS_Mesh;
class SMESHDS_SubMesh;
class SMESH_Gen;
class SMESH_Mesh;
class SMESH_ProxyMesh;
class SMESH_subMesh;
class TopoDS_Edge;
class TopoDS_Face;
class TopoDS_Vertex;
typedef std::map<SMESH_TLink, const SMDS_MeshNode*> TLinkNodeMap;
typedef std::map<SMESH_TLink, const SMDS_MeshNode*>::iterator ItTLinkNode;

View File

@ -38,6 +38,7 @@
#include "SMESH_Block.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MeshAlgos.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_subMesh.hxx"

View File

@ -1202,7 +1202,7 @@ bool SMESHDS_Mesh::IsGroupOfSubShapes (const TopoDS_Shape& theShape) const
return true;
for ( TopoDS_Iterator it( theShape ); it.More(); it.Next() )
if (IsGroupOfSubShapes( it.Value() ))
if ( IsGroupOfSubShapes( it.Value() ))
return true;
return false;

View File

@ -200,6 +200,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
BasePointGrpLayout->addWidget(ZLab);
BasePointGrpLayout->addWidget(ZSpin);
// Angles
AnglesGrp = new QGroupBox(tr("SMESH_ANGLES"), GroupArguments);
AnglesGrp->setCheckable(true);
AnglesGrp->setChecked(false);
@ -219,15 +220,42 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
LinearAnglesCheck = new QCheckBox(tr("LINEAR_ANGLES"), AnglesGrp);
// layouting
AnglesGrpLayout->addWidget(AnglesList, 0, 0, 4, 1);
AnglesGrpLayout->addWidget(AddAngleButton, 0, 1);
AnglesGrpLayout->addWidget(RemoveAngleButton, 2, 1);
AnglesGrpLayout->addWidget(AngleSpin, 0, 2);
AnglesGrpLayout->addWidget(LinearAnglesCheck, 4, 0);
AnglesGrpLayout->addWidget(LinearAnglesCheck, 4, 0, 1, 3);
AnglesGrpLayout->setRowMinimumHeight(1, 10);
AnglesGrpLayout->setRowStretch(3, 10);
// Scales
ScalesGrp = new QGroupBox(tr("SMESH_SCALES"), GroupArguments);
ScalesGrp->setCheckable(true);
ScalesGrp->setChecked(false);
QGridLayout* ScalesGrpLayout = new QGridLayout(ScalesGrp);
ScalesGrpLayout->setSpacing(SPACING); ScalesGrpLayout->setMargin(MARGIN);
ScalesList = new QListWidget(ScalesGrp);
ScalesList->setSelectionMode(QListWidget::ExtendedSelection);
AddScaleButton = new QToolButton(ScalesGrp);
AddScaleButton->setIcon(addImage);
RemoveScaleButton = new QToolButton(ScalesGrp);
RemoveScaleButton->setIcon(removeImage);
ScaleSpin = new SMESHGUI_SpinBox(ScalesGrp);
LinearScalesCheck = new QCheckBox(tr("LINEAR_SCALES"), ScalesGrp);
ScalesGrpLayout->addWidget(ScalesList, 0, 0, 4, 1);
ScalesGrpLayout->addWidget(AddScaleButton, 0, 1);
ScalesGrpLayout->addWidget(RemoveScaleButton, 2, 1);
ScalesGrpLayout->addWidget(ScaleSpin, 0, 2);
ScalesGrpLayout->addWidget(LinearScalesCheck, 4, 0, 1, 3);
ScalesGrpLayout->setRowMinimumHeight(1, 10);
ScalesGrpLayout->setRowStretch(3, 10);
// CheckBox for groups generation
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
MakeGroupsCheck->setChecked(true);
@ -236,10 +264,11 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
// layouting
GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0);
GroupArgumentsLayout->addWidget(PathGrp, 1, 0);
GroupArgumentsLayout->addWidget(BasePointGrp, 2, 0);
GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0, 1, 2);
GroupArgumentsLayout->addWidget(PathGrp, 1, 0, 1, 2);
GroupArgumentsLayout->addWidget(BasePointGrp, 2, 0, 1, 2);
GroupArgumentsLayout->addWidget(AnglesGrp, 3, 0);
GroupArgumentsLayout->addWidget(ScalesGrp, 3, 1);
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 4, 0);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0);
@ -282,12 +311,13 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
YSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
ZSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
AngleSpin->RangeStepAndValidator(-180.0, 180.0, 5.0, "angle_precision");
ScaleSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 1.0, "length_precision");
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector();
mySMESHGUI->SetActiveDialogBox(this);
myPathMeshFilter = new SMESH_TypeFilter(SMESH::MESHorSUBMESH);
myPathMeshFilter = new SMESH_TypeFilter(SMESH::IDSOURCE_EDGE);
myHelpFileName = "extrusion_along_path.html";
@ -302,6 +332,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
connect(AddAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleAdded()));
connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleRemoved()));
connect(AddScaleButton, SIGNAL(clicked()), this, SLOT(OnAngleAdded()));
connect(RemoveScaleButton, SIGNAL(clicked()), this, SLOT(OnAngleRemoved()));
connect(SelectPathMeshButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectStartPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
@ -324,19 +356,27 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
connect(ZSpin, SIGNAL(valueChanged(double)), 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(AddScaleButton, SIGNAL(clicked()), this, SLOT(toDisplaySimulation()));
connect(RemoveScaleButton, SIGNAL(clicked()), this, SLOT(toDisplaySimulation()));
connect(LinearScalesCheck, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
connect(LinearAnglesCheck, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
connect(ScalesGrp, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
connect(AnglesGrp, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
//To Connect preview check box
connectPreviewControl();
AnglesList ->installEventFilter(this);
ScalesList ->installEventFilter(this);
StartPointLineEdit->installEventFilter(this);
XSpin->editor() ->installEventFilter(this);
YSpin->editor() ->installEventFilter(this);
ZSpin->editor() ->installEventFilter(this);
CheckIsEnable();
resize( minimumSizeHint() );
}
//=================================================================================
@ -369,6 +409,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::Init (bool ResetControls)
ZSpin->SetValue(0.0);
AngleSpin->SetValue(45);
ScaleSpin->SetValue(2);
myPreviewCheckBox->setChecked(false);
onDisplaySimulation(false);
}
@ -416,12 +457,10 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
QStringList aParameters;
//get angles
SMESH::double_array_var anAngles = getAngles();
SMESH::double_array_var anAngles = getAngles();
for (int i = 0; i < myAnglesList.count(); i++)
aParameters << AnglesList->item(i)->text();
// get base point
SMESH::PointStruct aBasePoint;
if (BasePointGrp->isChecked()) {
@ -433,6 +472,11 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
aParameters << YSpin->text();
aParameters << ZSpin->text();
//get scales
SMESH::double_array_var aScales = getScales();
for (int i = 0; i < myScalesList.count(); i++)
aParameters << ScalesList->item(i)->text();
bool meshHadNewTypeBefore = true;
int maxSelType = 0;
const bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
@ -464,8 +508,8 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
GEOM::GEOM_Object::_nil(),
aNodeStart, AnglesGrp->isChecked(),
anAngles, LinearAnglesCheck->isChecked(),
BasePointGrp->isChecked(), aBasePoint,
makeGroups, retVal );
BasePointGrp->isChecked(), aBasePoint, makeGroups,
aScales, LinearScalesCheck->isChecked(), retVal );
wc.suspend();
switch (retVal) {
@ -911,17 +955,34 @@ void SMESHGUI_ExtrusionAlongPathDlg::enterEvent (QEvent*)
//=======================================================================
void SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded()
{
QString msg;
if( !AngleSpin->isValid( msg, true ) ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return;
if ( sender() == AddAngleButton )
{
QString msg;
if( !AngleSpin->isValid( msg, true ) ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return;
}
AnglesList->addItem(AngleSpin->text());
myAnglesList.append(AngleSpin->GetValue());
}
AnglesList->addItem(AngleSpin->text());
myAnglesList.append(AngleSpin->GetValue());
if ( sender() == AddScaleButton )
{
QString msg;
if( !ScaleSpin->isValid( msg, true ) ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return;
}
ScalesList->addItem(ScaleSpin->text());
myScalesList.append(ScaleSpin->GetValue());
}
updateLinearAngles();
}
@ -931,10 +992,23 @@ void SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded()
//=======================================================================
void SMESHGUI_ExtrusionAlongPathDlg::OnAngleRemoved()
{
QList<QListWidgetItem*> aList = AnglesList->selectedItems();
QListWidget* widget;
QList<double>* list;
if ( sender() == RemoveScaleButton )
{
widget = ScalesList;
list = & myScalesList;
}
else
{
widget = AnglesList;
list = & myAnglesList;
}
QList<QListWidgetItem*> aList = widget->selectedItems();
QListWidgetItem* anItem;
foreach(anItem, aList) {
myAnglesList.removeAt(AnglesList->row(anItem));
list->removeAt( widget->row( anItem ));
delete anItem;
}
@ -951,7 +1025,11 @@ bool SMESHGUI_ExtrusionAlongPathDlg::eventFilter (QObject* object, QEvent* event
QKeyEvent* ke = (QKeyEvent*)event;
if (object == AnglesList) {
if (ke->key() == Qt::Key_Delete)
OnAngleRemoved();
RemoveAngleButton->click();
}
if (object == ScalesList) {
if (ke->key() == Qt::Key_Delete)
RemoveScaleButton->click();
}
}
else if (event->type() == QEvent::FocusIn) {
@ -1023,6 +1101,19 @@ void SMESHGUI_ExtrusionAlongPathDlg::updateLinearAngles()
if( !enableLinear )
LinearAnglesCheck->setChecked( false );
LinearAnglesCheck->setEnabled( enableLinear );
enableLinear = true;
for( int row = 0, nbRows = ScalesList->count(); row < nbRows; row++ ) {
if( QListWidgetItem* anItem = ScalesList->item( row ) ) {
enableLinear = false;
anItem->text().toDouble(&enableLinear);
if( !enableLinear )
break;
}
}
if( !enableLinear )
LinearScalesCheck->setChecked( false );
LinearScalesCheck->setEnabled( enableLinear );
}
//=================================================================================
@ -1074,9 +1165,10 @@ void SMESHGUI_ExtrusionAlongPathDlg::onDisplaySimulation( bool toDisplayPreview
if ( myPreviewCheckBox->isChecked() && toDisplayPreview ) {
if ( SelectorWdg->IsAnythingSelected() && isValid() && isValuesValid())
{
// get angles
// get angles and scales
SMESH::double_array_var anAngles = getAngles();
SMESH::double_array_var aScales = getScales();
// get base point
SMESH::PointStruct aBasePoint;
if (BasePointGrp->isChecked()) {
@ -1107,7 +1199,9 @@ void SMESHGUI_ExtrusionAlongPathDlg::onDisplaySimulation( bool toDisplayPreview
aNodeStart, AnglesGrp->isChecked(),
anAngles, LinearAnglesCheck->isChecked(),
BasePointGrp->isChecked(), aBasePoint,
makeGroups, retVal );
makeGroups,
aScales, LinearScalesCheck->isChecked(),
retVal);
if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK )
{
@ -1133,18 +1227,36 @@ void SMESHGUI_ExtrusionAlongPathDlg::onDisplaySimulation( bool toDisplayPreview
}
}
//=======================================================================
//function : getAngles
//purpose : return CORBA array of angles
//=======================================================================
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++) {
double angle = myAnglesList[i];
anAngles[ j++ ] = angle*M_PI/180.;
}
anAngles->length(j);
anAngles->length( myAnglesList.count() );
for (int i = 0; i < myAnglesList.count(); i++)
anAngles[ i ] = myAnglesList[ i ] * M_PI / 180.;
}
return anAngles;
}
//=======================================================================
//function : getScales
//purpose : return CORBA array of scale factors
//=======================================================================
SMESH::double_array_var SMESHGUI_ExtrusionAlongPathDlg::getScales()
{
SMESH::double_array_var anScales = new SMESH::double_array;
if ( ScalesGrp->isChecked() )
{
anScales->length( myScalesList.count() );
for (int i = 0; i < myScalesList.count(); i++)
anScales[ i ] = myScalesList[ i ];
}
return anScales;
}

View File

@ -82,6 +82,7 @@ private:
bool isValuesValid();
SMESH::double_array_var getAngles();
SMESH::double_array_var getScales();
void updateLinearAngles();
@ -94,6 +95,7 @@ private:
SMESH::SMESH_IDSource_var myPath;
SUIT_SelectionFilter* myPathMeshFilter;
QList<double> myAnglesList;
QList<double> myScalesList;
// widgets
SMESHGUI_3TypesSelector* SelectorWdg;
@ -103,12 +105,21 @@ private:
QLineEdit* PathMeshLineEdit;
QPushButton* SelectStartPointButton;
QLineEdit* StartPointLineEdit;
QCheckBox* LinearAnglesCheck;
QGroupBox* AnglesGrp;
QListWidget* AnglesList;
QToolButton* AddAngleButton;
QToolButton* RemoveAngleButton;
SMESHGUI_SpinBox* AngleSpin;
QCheckBox* LinearScalesCheck;
QGroupBox* ScalesGrp;
QListWidget* ScalesList;
QToolButton* AddScaleButton;
QToolButton* RemoveScaleButton;
SMESHGUI_SpinBox* ScaleSpin;
QGroupBox* BasePointGrp;
QPushButton* SelectBasePointButton;
SMESHGUI_SpinBox* XSpin;

View File

@ -709,6 +709,8 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
// Scales
ScalesGrp = new QGroupBox(tr("SMESH_SCALES"), GroupArguments);
ScalesGrp->setCheckable(true);
ScalesGrp->setChecked(false);
QGridLayout* ScalesGrpLayout = new QGridLayout( ScalesGrp );
ScalesGrpLayout->setSpacing(SPACING); ScalesGrpLayout->setMargin(MARGIN);
@ -730,10 +732,40 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
ScalesGrpLayout->addWidget(AddScaleButton, 0, 1);
ScalesGrpLayout->addWidget(RemoveScaleButton, 2, 1);
ScalesGrpLayout->addWidget(ScaleSpin, 0, 2);
ScalesGrpLayout->addWidget(LinearScalesCheck, 4, 0);
ScalesGrpLayout->addWidget(LinearScalesCheck, 4, 0, 1, 3);
ScalesGrpLayout->setRowMinimumHeight(1, 10);
ScalesGrpLayout->setRowStretch(3, 10);
// Angles
AnglesGrp = new QGroupBox(tr("SMESH_ANGLES"), GroupArguments);
AnglesGrp->setCheckable(true);
AnglesGrp->setChecked(false);
QGridLayout* AnglesGrpLayout = new QGridLayout( AnglesGrp );
AnglesGrpLayout->setSpacing(SPACING); AnglesGrpLayout->setMargin(MARGIN);
AnglesList = new QListWidget( AnglesGrp );
AnglesList->setSelectionMode(QListWidget::ExtendedSelection);
AddAngleButton = new QToolButton( AnglesGrp );
AddAngleButton->setIcon( addImage );
RemoveAngleButton = new QToolButton( AnglesGrp );
RemoveAngleButton->setIcon( removeImage );
AngleSpin = new SMESHGUI_SpinBox( AnglesGrp );
AngleSpin->SetValue(10);
LinearAnglesCheck = new QCheckBox(tr("LINEAR_ANGLES"), AnglesGrp );
AnglesGrpLayout->addWidget(AnglesList, 0, 0, 4, 1);
AnglesGrpLayout->addWidget(AddAngleButton, 0, 1);
AnglesGrpLayout->addWidget(RemoveAngleButton, 2, 1);
AnglesGrpLayout->addWidget(AngleSpin, 0, 2);
AnglesGrpLayout->addWidget(LinearAnglesCheck, 4, 0, 1, 3);
AnglesGrpLayout->setRowMinimumHeight(1, 10);
AnglesGrpLayout->setRowStretch(3, 10);
// layouting
GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0, 1, 9);
GroupArgumentsLayout->addWidget(ExtrMethod_RBut0, 1, 0, 1, 3);
@ -761,7 +793,8 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
GroupArgumentsLayout->addWidget(ByAverageNormalCheck, 6, 0, 1, 4);
GroupArgumentsLayout->addWidget(UseInputElemsOnlyCheck, 6, 4, 1, 4);
GroupArgumentsLayout->addWidget(BasePointGrp, 7, 0, 1, 9);
GroupArgumentsLayout->addWidget(ScalesGrp, 8, 0, 1, 9);
GroupArgumentsLayout->addWidget(ScalesGrp, 8, 0, 1, 4);
GroupArgumentsLayout->addWidget(AnglesGrp, 8, 5, 1, 4);
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 9, 0, 1, 8);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 10,0, 1, 8);
GroupArgumentsLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 10, 0);
@ -810,12 +843,13 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
BasePoint_YSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
BasePoint_ZSpin->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
ScaleSpin->RangeStepAndValidator (COORD_MIN, COORD_MAX, 1.0, "length_precision");
AngleSpin->RangeStepAndValidator (-180.0, 180.0, 5.0, "angle_precision");
ExtrMethod_RBut0->setChecked(true);
UseInputElemsOnlyCheck->setChecked(true);
MakeGroupsCheck->setChecked(true);
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector();
mySMESHGUI->SetActiveDialogBox(this);
@ -844,6 +878,8 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
connect(AddScaleButton, SIGNAL(clicked()), this, SLOT(OnScaleAdded()));
connect(RemoveScaleButton, SIGNAL(clicked()), this, SLOT(OnScaleRemoved()));
connect(AddAngleButton, SIGNAL(clicked()), this, SLOT(OnScaleAdded()));
connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(OnScaleRemoved()));
connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectBasePointButton,SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
@ -871,10 +907,15 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
connect(AddScaleButton, SIGNAL(clicked()), this, SLOT(toDisplaySimulation()));
connect(RemoveScaleButton, SIGNAL(clicked()), this, SLOT(toDisplaySimulation()));
connect(LinearScalesCheck, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
connect(AddAngleButton, SIGNAL(clicked()), this, SLOT(toDisplaySimulation()));
connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(toDisplaySimulation()));
connect(LinearAnglesCheck, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
connect(BasePointGrp, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
connect(BasePoint_XSpin, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(BasePoint_YSpin, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(BasePoint_ZSpin, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
connect(ScalesGrp, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
connect(AnglesGrp, SIGNAL(toggled(bool)), this, SLOT(toDisplaySimulation()));
//To Connect preview check box
connectPreviewControl();
@ -964,14 +1005,26 @@ bool SMESHGUI_ExtrusionDlg::isValuesValid()
//purpose : return 3 scaling parameters
//=======================================================================
bool SMESHGUI_ExtrusionDlg::getScaleParams( SMESH::double_array*& scales,
SMESH::double_array*& basePoint )
void SMESHGUI_ExtrusionDlg::getScaleParams( SMESH::double_array*& scales,
SMESH::double_array*& basePoint,
bool & scalesVariation,
SMESH::double_array*& angles,
bool & anglesVariation )
{
scales = new SMESH::double_array;
scales->length( myScalesList.count() );
for ( int i = 0; i < myScalesList.count(); ++i )
(*scales)[i] = myScalesList[i];
if ( ScalesGrp->isChecked() )
{
scales->length( myScalesList.count() );
for ( int i = 0; i < myScalesList.count(); ++i )
(*scales)[i] = myScalesList[i];
}
angles = new SMESH::double_array;
if ( AnglesGrp->isChecked() )
{
angles->length( myAnglesList.count() );
for ( int i = 0; i < myAnglesList.count(); ++i )
(*angles)[i] = myAnglesList[i]*M_PI/180.;
}
basePoint = new SMESH::double_array;
if ( BasePointGrp->isChecked() )
{
@ -981,7 +1034,8 @@ bool SMESHGUI_ExtrusionDlg::getScaleParams( SMESH::double_array*& scales,
(*basePoint)[2] = BasePoint_ZSpin->GetValue();
}
return ( scales->length() > 0 && LinearScalesCheck->isChecked() );
scalesVariation = ( scales->length() > 0 && LinearScalesCheck->isChecked() );
anglesVariation = ( angles->length() > 0 && LinearAnglesCheck->isChecked() );
}
//=================================================================================
@ -1074,6 +1128,7 @@ void SMESHGUI_ExtrusionDlg::ClickOnRadio()
BasePointGrp->setEnabled( !ExtrMethod_RBut2->isChecked() );
ScalesGrp ->setEnabled( !ExtrMethod_RBut2->isChecked() );
AnglesGrp ->setEnabled( !ExtrMethod_RBut2->isChecked() );
CheckIsEnable();
@ -1126,13 +1181,11 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
long aNbSteps = (long)SpinBox_NbSteps->value();
aParameters << SpinBox_NbSteps->text();
SMESH::double_array_var scales = new SMESH::double_array;
scales->length( myScalesList.count() );
for (int i = 0; i < myScalesList.count(); i++)
{
scales[i] = myScalesList[i];
aParameters << ScalesList->item(i)->text();
}
for (int i = 0; i < myAnglesList.count(); i++)
aParameters << AnglesList->item(i)->text();
bool meshHadNewTypeBefore = true;
int maxSelType = 0;
@ -1175,12 +1228,14 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
}
else
{
SMESH::double_array_var scales, basePoint;
bool linVariation = getScaleParams( scales.out(), basePoint.out() );
SMESH::double_array_var scales, basePoint, angles;
bool scalesVariation, anglesVariation;
getScaleParams( scales.out(), basePoint.out(), scalesVariation,
angles.out(), anglesVariation );
groups = meshEditor->ExtrusionSweepObjects( nodes, edges, faces,
aVector, aNbSteps,
scales, linVariation, basePoint,
makeGroups );
aVector, aNbSteps, makeGroups,
scales, scalesVariation, basePoint,
angles, anglesVariation );
}
} catch (...) {
@ -1565,12 +1620,14 @@ void SMESHGUI_ExtrusionDlg::onDisplaySimulation( bool toDisplayPreview )
}
else
{
SMESH::double_array_var scales, basePoint;
bool linVariation = getScaleParams( scales.out(), basePoint.out() );
SMESH::double_array_var scales, basePoint, angles;
bool scalesVariation, anglesVariation;
getScaleParams( scales.out(), basePoint.out(), scalesVariation,
angles.out(), anglesVariation );
groups = meshEditor->ExtrusionSweepObjects( nodes, edges, faces,
aVector, aNbSteps,
scales, linVariation, basePoint,
makeGroups );
aVector, aNbSteps, makeGroups,
scales, scalesVariation, basePoint,
angles, anglesVariation );
}
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = meshEditor->GetPreviewData();
mySimulation->SetData(aMeshPreviewStruct);
@ -1614,35 +1671,65 @@ void SMESHGUI_ExtrusionDlg::getExtrusionVector(SMESH::DirStruct& aVector)
//=======================================================================
// function : OnScaleAdded()
// purpose : Called when user adds Scale to the list
// purpose : Called when user adds Scale or Angle to the list
//=======================================================================
void SMESHGUI_ExtrusionDlg::OnScaleAdded()
{
QString msg;
if( !ScaleSpin->isValid( msg, true ) ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return;
if ( sender() == AddScaleButton )
{
QString msg;
if( !ScaleSpin->isValid( msg, true ) ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return;
}
ScalesList->addItem(ScaleSpin->text());
myScalesList.append(ScaleSpin->GetValue());
}
if ( sender() == AddAngleButton )
{
QString msg;
if( !AngleSpin->isValid( msg, true ) ) {
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
if ( !msg.isEmpty() )
str += "\n" + msg;
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
return;
}
AnglesList->addItem(AngleSpin->text());
myAnglesList.append(AngleSpin->GetValue());
}
ScalesList->addItem(ScaleSpin->text());
myScalesList.append(ScaleSpin->GetValue());
}
//=======================================================================
// function : OnScaleRemoved()
// purpose : Called when user removes Scale(s) from the list
// purpose : Called when user removes Scales or Angles from the list
//=======================================================================
void SMESHGUI_ExtrusionDlg::OnScaleRemoved()
{
QList<QListWidgetItem*> aList = ScalesList->selectedItems();
QListWidget* widget;
QList<double>* list;
if ( sender() == RemoveScaleButton )
{
widget = ScalesList;
list = & myScalesList;
}
else
{
widget = AnglesList;
list = & myAnglesList;
}
QList<QListWidgetItem*> aList = widget->selectedItems();
QListWidgetItem* anItem;
int row = 0;
foreach(anItem, aList) {
row = ScalesList->row(anItem);
myScalesList.removeAt(row);
row = widget->row(anItem);
list->removeAt(row);
delete anItem;
}
ScalesList->setCurrentRow( row, QItemSelectionModel::Select );
widget->setCurrentRow( row, QItemSelectionModel::Select );
}

View File

@ -145,8 +145,11 @@ private:
void getExtrusionVector(SMESH::DirStruct& aVector);
void extrusionByNormal(SMESH::SMESH_MeshEditor_ptr meshEditor,
const bool makeGroups=false);
bool getScaleParams( SMESH::double_array*& scales,
SMESH::double_array*& basePoint );
void getScaleParams( SMESH::double_array*& scales,
SMESH::double_array*& basePoint,
bool & scalesVariation,
SMESH::double_array*& angles,
bool & anglesVariation);
bool isValid();
bool isValuesValid();
@ -154,6 +157,7 @@ private:
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
SVTK_Selector* mySelector;
QList<double> myScalesList;
QList<double> myAnglesList;
// widgets
SMESHGUI_3TypesSelector* SelectorWdg;
@ -198,6 +202,13 @@ private:
SMESHGUI_SpinBox* ScaleSpin;
QCheckBox* LinearScalesCheck;
QGroupBox* AnglesGrp;
QListWidget* AnglesList;
QToolButton* AddAngleButton;
QToolButton* RemoveAngleButton;
SMESHGUI_SpinBox* AngleSpin;
QCheckBox* LinearAnglesCheck;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;

View File

@ -1847,15 +1847,15 @@ Do you want to continue?</translation>
</message>
<message>
<source>SMESH_EXTRUSION_TO_DISTANCE</source>
<translation>Extrusion To Distance</translation>
<translation>Extrusion to distance</translation>
</message>
<message>
<source>SMESH_EXTRUSION_ALONG_VECTOR</source>
<translation>Extrusion Along Vector</translation>
<translation>Extrusion along vector</translation>
</message>
<message>
<source>SMESH_EXTRUSION_BY_NORMAL</source>
<translation>Extrusion By Normal</translation>
<translation>Extrusion by normal</translation>
</message>
<message>
<source>SMESH_FACE</source>
@ -5517,18 +5517,6 @@ Please select a group and try again</translation>
<source>CANT_GET_TANGENT</source>
<translation>Can&apos;t get tangent for one of the path nodes</translation>
</message>
<message>
<source>EXTRUSION_0D</source>
<translation>Extrusion of 0D elements</translation>
</message>
<message>
<source>EXTRUSION_1D</source>
<translation>Extrusion of 1D elements</translation>
</message>
<message>
<source>EXTRUSION_2D</source>
<translation>Extrusion of 2D elements</translation>
</message>
<message>
<source>EXTRUSION_ALONG_PATH</source>
<translation>Extrusion along a path</translation>
@ -5539,7 +5527,7 @@ Please select a group and try again</translation>
</message>
<message>
<source>LINEAR_ANGLES</source>
<translation>Linear variation of the angles</translation>
<translation>Linear variation of angles</translation>
</message>
<message>
<source>NO_ELEMENTS_SELECTED</source>
@ -5551,11 +5539,19 @@ Please select a group and try again</translation>
</message>
<message>
<source>SMESH_ANGLES</source>
<translation>Rotation Angles</translation>
<translation>Rotation angles</translation>
</message>
<message>
<source>SMESH_BASE_POINT</source>
<translation>Base Point</translation>
<translation>Base point</translation>
</message>
<message>
<source>SMESH_SCALES</source>
<translation>Scale factors</translation>
</message>
<message>
<source>LINEAR_SCALES</source>
<translation>Linear variation of factors</translation>
</message>
<message>
<source>SMESH_PATH</source>
@ -5575,11 +5571,11 @@ Please select a group and try again</translation>
</message>
<message>
<source>SMESH_USE_ANGLES</source>
<translation>Use Angles</translation>
<translation>Use angles</translation>
</message>
<message>
<source>SMESH_USE_BASE_POINT</source>
<translation>Use Base Point</translation>
<translation>Use base point</translation>
</message>
<message>
<source>WRONG_ANGLES_NUMBER</source>
@ -5588,18 +5584,6 @@ Please select a group and try again</translation>
</context>
<context>
<name>SMESHGUI_ExtrusionDlg</name>
<message>
<source>EXTRUSION_0D</source>
<translation>Extrusion of nodes</translation>
</message>
<message>
<source>EXTRUSION_1D</source>
<translation>Extrusion of 1D elements</translation>
</message>
<message>
<source>EXTRUSION_2D</source>
<translation>Extrusion of 2D elements</translation>
</message>
<message>
<source>EXTRUSION_ALONG_LINE</source>
<translation>Extrusion along a line</translation>
@ -5614,15 +5598,23 @@ Please select a group and try again</translation>
</message>
<message>
<source>SMESH_SCALES</source>
<translation>Scale Factors</translation>
<translation>Scale factors</translation>
</message>
<message>
<source>LINEAR_SCALES</source>
<translation>Linear Variation of Scale Factors</translation>
<translation>Linear variation of factors</translation>
</message>
<message>
<source>BASE_POINT</source>
<translation>Scaling Center</translation>
<translation>Base point</translation>
</message>
<message>
<source>LINEAR_ANGLES</source>
<translation>Linear variation of angles</translation>
</message>
<message>
<source>SMESH_ANGLES</source>
<translation>Rotation angles</translation>
</message>
</context>
<context>

View File

@ -79,8 +79,8 @@ class SMESHUtils_EXPORT SMESH_Delaunay
// return UV of the i-th source boundary node (zero based)
gp_XY GetBndUV(const int iNode) const;
// return scale factor to convert real UV to/from UV used for Delauney meshing:
// delauney_UV = real_UV * scale
// return scale factor to convert real UV to/from UV used for Delaunay meshing:
// delaunay_UV = real_UV * scale
const gp_XY& GetScale() const { return _scale; }
void ToPython() const;

View File

@ -1764,7 +1764,7 @@ double SMESH_MeshAlgos::GetDistance( const SMDS_MeshVolume* volume,
!vTool.GetFaceBaryCenter( iF, bc[0], bc[1], bc[2] ))
continue;
gp_XYZ bcp = point.XYZ() - gp_XYZ( bc[0], bc[1], bc[2] );
if ( gp_XYZ( n[0], n[1], n[2] ) * bcp < 1e-6 )
if ( gp_XYZ( n[0], n[1], n[2] ) * bcp < -1e-12 )
continue;
// find distance to a facet

View File

@ -2496,7 +2496,8 @@ namespace MeshEditor_I
bool myIsExtrusionByNormal;
static int makeFlags( CORBA::Boolean MakeGroups,
CORBA::Boolean LinearVariation = false,
CORBA::Boolean ScaleVariation = false,
CORBA::Boolean AngleVariation = false,
CORBA::Boolean ByAverageNormal = false,
CORBA::Boolean UseInputElemsOnly = false,
CORBA::Long Flags = 0,
@ -2505,7 +2506,8 @@ namespace MeshEditor_I
if ( MakeGroups ) Flags |= ::SMESH_MeshEditor::EXTRUSION_FLAG_GROUPS;
if ( ByAverageNormal ) Flags |= ::SMESH_MeshEditor::EXTRUSION_FLAG_BY_AVG_NORMAL;
if ( UseInputElemsOnly) Flags |= ::SMESH_MeshEditor::EXTRUSION_FLAG_USE_INPUT_ELEMS_ONLY;
if ( LinearVariation ) Flags |= ::SMESH_MeshEditor::EXTRUSION_FLAG_SCALE_LINEAR_VARIATION;
if ( ScaleVariation ) Flags |= ::SMESH_MeshEditor::EXTRUSION_FLAG_SCALE_LINEAR_VARIATION;
if ( AngleVariation ) Flags |= ::SMESH_MeshEditor::EXTRUSION_FLAG_ANGLE_LINEAR_VARIATION;
if ( MakeBoundary ) Flags |= ::SMESH_MeshEditor::EXTRUSION_FLAG_BOUNDARY;
return Flags;
}
@ -2513,7 +2515,9 @@ namespace MeshEditor_I
ExtrusionParams(const SMESH::DirStruct & theDir,
CORBA::Long theNbOfSteps,
const SMESH::double_array & theScaleFactors,
CORBA::Boolean theLinearVariation,
CORBA::Boolean theScaleVariation,
const SMESH::double_array & theAngles,
CORBA::Boolean theAngleVariation,
const SMESH::double_array & theBasePoint,
CORBA::Boolean theMakeGroups):
::SMESH_MeshEditor::ExtrusParam ( gp_Vec( theDir.PS.x,
@ -2521,8 +2525,9 @@ namespace MeshEditor_I
theDir.PS.z ),
theNbOfSteps,
toList( theScaleFactors ),
toList( theAngles ),
TBasePoint( theBasePoint ),
makeFlags( theMakeGroups, theLinearVariation )),
makeFlags( theMakeGroups, theScaleVariation, theAngleVariation )),
myIsExtrusionByNormal( false )
{
}
@ -2537,8 +2542,9 @@ namespace MeshEditor_I
theDir.PS.z ),
theNbOfSteps,
std::list<double>(),
std::list<double>(),
0,
makeFlags( theMakeGroups, false, false, false,
makeFlags( theMakeGroups, false, false, false, false,
theExtrFlags, false ),
theSewTolerance ),
myIsExtrusionByNormal( false )
@ -2553,7 +2559,7 @@ namespace MeshEditor_I
CORBA::Boolean theMakeGroups ):
::SMESH_MeshEditor::ExtrusParam ( theStepSize,
theNbOfSteps,
makeFlags( theMakeGroups, false,
makeFlags( theMakeGroups, false, false,
theByAverageNormal, theUseInputElemsOnly ),
theDim),
myIsExtrusionByNormal( true )
@ -2565,8 +2571,6 @@ namespace MeshEditor_I
Flags() &= ~(::SMESH_MeshEditor::EXTRUSION_FLAG_GROUPS);
}
private:
static std::list<double> toList( const SMESH::double_array & theScaleFactors )
{
std::list<double> scales;
@ -2575,6 +2579,8 @@ namespace MeshEditor_I
return scales;
}
private:
// structure used to convert SMESH::double_array to gp_XYZ*
struct TBasePoint
{
@ -2613,17 +2619,19 @@ SMESH_MeshEditor_i::ExtrusionSweepObjects(const SMESH::ListOfIDSources & theNode
const SMESH::ListOfIDSources & theFaces,
const SMESH::DirStruct & theStepVector,
CORBA::Long theNbOfSteps,
CORBA::Boolean theToMakeGroups,
const SMESH::double_array & theScaleFactors,
CORBA::Boolean theLinearVariation,
CORBA::Boolean theScalesVariation,
const SMESH::double_array & theBasePoint,
CORBA::Boolean theToMakeGroups)
const SMESH::double_array & theAngles,
CORBA::Boolean theAnglesVariation)
throw (SALOME::SALOME_Exception)
{
SMESH_TRY;
initData();
ExtrusionParams params( theStepVector, theNbOfSteps, theScaleFactors,
theLinearVariation, theBasePoint, theToMakeGroups );
ExtrusionParams params( theStepVector, theNbOfSteps, theScaleFactors, theScalesVariation,
theAngles, theAnglesVariation, theBasePoint, theToMakeGroups );
TIDSortedElemSet elemsNodes[2];
for ( int i = 0, nb = theNodes.length(); i < nb; ++i ) {
@ -2664,12 +2672,17 @@ SMESH_MeshEditor_i::ExtrusionSweepObjects(const SMESH::ListOfIDSources & theNode
{
dumpGroupsList( aPythonDump, aGroups );
aPythonDump << this<< ".ExtrusionSweepObjects( "
<< theNodes << ", "
<< theEdges << ", "
<< theFaces << ", "
<< theStepVector << ", "
<< TVar( theNbOfSteps ) << ", "
<< theToMakeGroups << " )";
<< theNodes << ", "
<< theEdges << ", "
<< theFaces << ", "
<< theStepVector << ", "
<< TVar( theNbOfSteps ) << ", "
<< theToMakeGroups << ", "
<< TVar( theScaleFactors ) << ", "
<< theScalesVariation << ", "
<< TVar( theBasePoint ) << ", "
<< TVar( theAngles ) << ", "
<< theAnglesVariation << " )";
}
else
{
@ -2847,15 +2860,17 @@ SMESH::ListOfGroups*
SMESH_MeshEditor_i::ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & theNodes,
const SMESH::ListOfIDSources & theEdges,
const SMESH::ListOfIDSources & theFaces,
SMESH::SMESH_IDSource_ptr thePathMesh,
SMESH::SMESH_IDSource_ptr thePathObject,
GEOM::GEOM_Object_ptr thePathShape,
CORBA::Long theNodeStart,
CORBA::Boolean theHasAngles,
const SMESH::double_array & theAngles,
CORBA::Boolean theLinearVariation,
CORBA::Boolean theAnglesVariation,
CORBA::Boolean theHasRefPoint,
const SMESH::PointStruct & theRefPoint,
bool theMakeGroups,
const SMESH::double_array & theScaleFactors,
CORBA::Boolean theScalesVariation,
SMESH::SMESH_MeshEditor::Extrusion_Error& theError)
throw (SALOME::SALOME_Exception)
{
@ -2865,45 +2880,58 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & the
SMESH::ListOfGroups_var aGroups = new SMESH::ListOfGroups;
theError = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
if ( thePathMesh->_is_nil() )
if ( thePathObject->_is_nil() )
return aGroups._retn();
// get a sub-mesh
SMESH_subMesh* aSubMesh = 0;
SMESH_Mesh_i* aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( thePathMesh );
if ( thePathShape->_is_nil() )
SMDS_ElemIteratorPtr pathEdgesIterator;
SMESH_Mesh_i* aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( thePathObject );
if ( !CORBA::is_nil( thePathShape ) && aMeshImp )
{
// 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() )
{
// get a sub-mesh of thePathShape
TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape );
SMESH_subMesh* aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape );
if ( !aSubMesh )
return aGroups._retn();
if ( !aSubMesh->GetSubMeshDS() )
{
SMESHDS_Mesh * meshDS = aMeshImp->GetImpl().GetMeshDS();
meshDS->AddCompoundSubmesh( aShape, TopAbs_EDGE );
if ( !aSubMesh->GetSubMeshDS() )
return aGroups._retn();
}
theError = SMESH::SMESH_MeshEditor::EXTR_PATH_NOT_EDGE;
pathEdgesIterator = aSubMesh->GetSubMeshDS()->GetElements();
if ( !pathEdgesIterator->more() ||
pathEdgesIterator->next()->GetType() != SMDSAbs_Edge )
return aGroups._retn();
pathEdgesIterator = aSubMesh->GetSubMeshDS()->GetElements();
}
else
{
if ( !aMeshImp ) return aGroups._retn();
TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape );
aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape );
if ( !aSubMesh /*|| !aSubMesh->GetSubMeshDS()*/ )
theError = SMESH::SMESH_MeshEditor::EXTR_PATH_NOT_EDGE;
prepareIdSource( thePathObject );
pathEdgesIterator = SMESH_Mesh_i::GetElements( thePathObject, SMESH::EDGE );
if ( !pathEdgesIterator || !pathEdgesIterator->more() )
return aGroups._retn();
}
SMDS_MeshNode* nodeStart =
(SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(theNodeStart);
if ( !nodeStart ) {
theError = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
return aGroups._retn();
if ( !aMeshImp )
{
SMESH::SMESH_Mesh_var pathMesh = thePathObject->GetMesh();
aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( pathMesh );
}
theError = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
const SMDS_MeshNode* nodeStart = aMeshImp->GetImpl().GetMeshDS()->FindNode( theNodeStart );
if ( !nodeStart )
return aGroups._retn();
TIDSortedElemSet elemsNodes[2];
for ( int i = 0, nb = theNodes.length(); i < nb; ++i ) {
if ( SMDS_ElemIteratorPtr nIt = myMesh_i->GetElements( theNodes[i], SMESH::NODE ))
@ -2914,12 +2942,11 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & the
for ( int i = 0, nb = theFaces.length(); i < nb; ++i )
idSourceToSet( theFaces[i], getMeshDS(), elemsNodes[0], SMDSAbs_Face );
list<double> angles;
for ( CORBA::ULong i = 0; i < theAngles.length(); i++ ) {
angles.push_back( theAngles[i] );
}
list<double> angles = ExtrusionParams::toList( theAngles );
list<double> scales = ExtrusionParams::toList( theScaleFactors );
gp_Pnt refPnt( theRefPoint.x, theRefPoint.y, theRefPoint.z );
const gp_Pnt *refPntPtr = theHasRefPoint ? &refPnt : 0;
int nbOldGroups = myMesh->NbGroup();
@ -2934,15 +2961,12 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & the
theMakeGroups = false;
}
::SMESH_MeshEditor::Extrusion_Error error;
if ( !aSubMesh )
error = getEditor().ExtrusionAlongTrack( workElements, &(aMeshImp->GetImpl()), nodeStart,
theHasAngles, angles, theLinearVariation,
theHasRefPoint, refPnt, theMakeGroups );
else
error = getEditor().ExtrusionAlongTrack( workElements, aSubMesh, nodeStart,
theHasAngles, angles, theLinearVariation,
theHasRefPoint, refPnt, theMakeGroups );
::SMESH_MeshEditor::Extrusion_Error error =
getEditor().ExtrusionAlongTrack( workElements,
&(aMeshImp->GetImpl()), pathEdgesIterator, nodeStart,
angles, theAnglesVariation,
scales, theScalesVariation,
refPntPtr, theMakeGroups );
declareMeshModified( /*isReComputeSafe=*/true );
theError = convExtrError( error );
@ -2964,18 +2988,20 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & the
<< theNodes << ", "
<< theEdges << ", "
<< theFaces << ", "
<< thePathMesh << ", "
<< thePathObject << ", "
<< thePathShape << ", "
<< theNodeStart << ", "
<< theHasAngles << ", "
<< TVar( theAngles ) << ", "
<< theLinearVariation << ", "
<< theAnglesVariation << ", "
<< theHasRefPoint << ", "
<< "SMESH.PointStruct( "
<< TVar( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
<< TVar( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
<< TVar( theHasRefPoint ? theRefPoint.z : 0 ) << " ), "
<< theMakeGroups << " )";
<< theMakeGroups << ", "
<< TVar( theScaleFactors ) << ", "
<< theScalesVariation << " )";
}
else
{

View File

@ -322,25 +322,27 @@ public:
void RenumberNodes() throw (SALOME::SALOME_Exception);
void RenumberElements() throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* RotationSweepObjects(const SMESH::ListOfIDSources & nodes,
const SMESH::ListOfIDSources & edges,
const SMESH::ListOfIDSources & faces,
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)
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,
const SMESH::double_array & theScaleFactors,
CORBA::Boolean theLinearVariation,
const SMESH::double_array & theBasePoint,
CORBA::Boolean toMakeGroups)
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,
const SMESH::double_array & ScaleFactors,
CORBA::Boolean ScalesVariation,
const SMESH::double_array & BasePoint,
const SMESH::double_array & Angles,
CORBA::Boolean AnglesVariation)
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* ExtrusionByNormal(const SMESH::ListOfIDSources& objects,
@ -360,18 +362,20 @@ public:
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups*
ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & nodes,
const SMESH::ListOfIDSources & edges,
const SMESH::ListOfIDSources & faces,
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 AnglesVariation,
CORBA::Boolean HasRefPoint,
const SMESH::PointStruct & RefPoint,
bool MakeGroups,
const SMESH::double_array & ScaleFactors,
CORBA::Boolean ScalesVariation,
SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
throw (SALOME::SALOME_Exception);

View File

@ -752,26 +752,28 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
"""
if not meshes: return None
for i,m in enumerate(meshes):
if isinstance(m, Mesh):
if not isinstance( meshes, list ):
meshes = [ meshes ]
for i,m in enumerate( meshes ):
if isinstance( m, Mesh ):
meshes[i] = m.GetMesh()
mergeTolerance,Parameters,hasVars = ParseParameters(mergeTolerance)
mergeTolerance,Parameters,hasVars = ParseParameters( mergeTolerance )
if hasattr(meshes[0], "SetParameters"):
meshes[0].SetParameters(Parameters)
meshes[0].SetParameters( Parameters )
else:
meshes[0].GetMesh().SetParameters(Parameters)
meshes[0].GetMesh().SetParameters( Parameters )
if isinstance( meshToAppendTo, Mesh ):
meshToAppendTo = meshToAppendTo.GetMesh()
if allGroups:
aSmeshMesh = SMESH._objref_SMESH_Gen.ConcatenateWithGroups(
self,meshes,uniteIdenticalGroups,mergeNodesAndElements,
mergeTolerance,meshToAppendTo)
mergeTolerance,meshToAppendTo )
else:
aSmeshMesh = SMESH._objref_SMESH_Gen.Concatenate(
self,meshes,uniteIdenticalGroups,mergeNodesAndElements,
mergeTolerance,meshToAppendTo)
mergeTolerance,meshToAppendTo )
aMesh = Mesh(self, self.geompyD, aSmeshMesh, name=name)
aMesh = Mesh( self, self.geompyD, aSmeshMesh, name=name )
return aMesh
def CopyMesh( self, meshPart, meshName, toCopyGroups=False, toKeepIDs=False):
@ -2501,6 +2503,25 @@ class Mesh(metaclass = MeshMeta):
minor = -1
# invoke engine's function
self.mesh.ExportMED(fileName, auto_groups, minor, overwrite, autoDimension)
return
def Append(self, meshes, uniteIdenticalGroups = True,
mergeNodesAndElements = False, mergeTolerance = 1e-5, allGroups = False):
"""
Append given meshes into this mesh.
All groups of input meshes will be created in this mesh.
Parameters:
meshes: :class:`meshes, sub-meshes, groups or filters <SMESH.SMESH_IDSource>` to append
uniteIdenticalGroups: if True, groups with same names are united, else they are renamed
mergeNodesAndElements: if True, equal nodes and elements are merged
mergeTolerance: tolerance for merging nodes
allGroups: forces creation of groups corresponding to every input mesh
"""
self.smeshpyD.Concatenate( meshes, uniteIdenticalGroups,
mergeNodesAndElements, mergeTolerance, allGroups,
meshToAppendTo = self.GetMesh() )
# Operations with groups:
# ----------------------
@ -5340,7 +5361,8 @@ class Mesh(metaclass = MeshMeta):
NbOfSteps, Tolerance, MakeGroups, TotalAngle)
def ExtrusionSweepObjects(self, nodes, edges, faces, StepVector, NbOfSteps, MakeGroups=False,
scaleFactors=[], linearVariation=False, basePoint=[] ):
scaleFactors=[], linearVariation=False, basePoint=[],
angles=[], anglesVariation=False):
"""
Generate new elements by extrusion of the given elements and nodes
@ -5354,15 +5376,19 @@ class Mesh(metaclass = MeshMeta):
NbOfSteps: the number of steps
MakeGroups: forces the generation of new groups from existing ones
scaleFactors: optional scale factors to apply during extrusion
linearVariation: if *True*, scaleFactors are spread over all *scaleFactors*,
else scaleFactors[i] is applied to nodes at the i-th extrusion step
basePoint: optional scaling center; if not provided, a gravity center of
linearVariation: if *True*, *scaleFactors* are spread over all *NbOfSteps*,
else *scaleFactors* [i] is applied to nodes at the i-th extrusion step
basePoint: optional scaling and rotation center; if not provided, a gravity center of
nodes and elements being extruded is used as the scaling center.
It can be either
- a list of tree components of the point or
- a node ID or
- a GEOM point
angles: list of angles in radians. Nodes at each extrusion step are rotated
around *basePoint*, additionally to previous steps.
anglesVariation: forces the computation of rotation angles as linear
variation of the given *angles* along path steps
Returns:
the list of created :class:`groups <SMESH.SMESH_GroupBase>` if *MakeGroups* == True, empty list otherwise
@ -5387,13 +5413,17 @@ class Mesh(metaclass = MeshMeta):
basePoint = self.geompyD.PointCoordinates( basePoint )
NbOfSteps,Parameters,hasVars = ParseParameters(NbOfSteps)
Parameters = StepVector.PS.parameters + var_separator + Parameters
scaleFactors,scaleParameters,hasVars = ParseParameters(scaleFactors)
angles,angleParameters,hasVars = ParseAngles(angles)
Parameters = StepVector.PS.parameters + var_separator + \
Parameters + var_separator + \
scaleParameters + var_separator + angleParameters
self.mesh.SetParameters(Parameters)
return self.editor.ExtrusionSweepObjects( nodes, edges, faces,
StepVector, NbOfSteps,
StepVector, NbOfSteps, MakeGroups,
scaleFactors, linearVariation, basePoint,
MakeGroups)
angles, anglesVariation )
def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False, IsNodes = False):
@ -5555,9 +5585,10 @@ class Mesh(metaclass = MeshMeta):
return self.editor.AdvancedExtrusion(IDsOfElements, StepVector, NbOfSteps,
ExtrFlags, SewTolerance, MakeGroups)
def ExtrusionAlongPathObjects(self, Nodes, Edges, Faces, PathMesh, PathShape=None,
def ExtrusionAlongPathObjects(self, Nodes, Edges, Faces, PathObject, PathShape=None,
NodeStart=1, HasAngles=False, Angles=[], LinearVariation=False,
HasRefPoint=False, RefPoint=[0,0,0], MakeGroups=False):
HasRefPoint=False, RefPoint=[0,0,0], MakeGroups=False,
ScaleFactors=[], ScalesVariation=False):
"""
Generate new elements by extrusion of the given elements and nodes along the path.
The path of extrusion must be a meshed edge.
@ -5566,20 +5597,22 @@ class Mesh(metaclass = MeshMeta):
Nodes: nodes to extrude: a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`
Edges: edges to extrude: a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`
Faces: faces to extrude: a list including ids, :class:`a mesh, sub-meshes, groups or filters <SMESH.SMESH_IDSource>`
PathMesh: 1D mesh or 1D sub-mesh, along which proceeds the extrusion
PathShape: shape (edge) defines the sub-mesh of PathMesh if PathMesh
contains not only path segments, else it can be None
PathObject: :class:`mesh, sub-mesh, group or filter <SMESH.SMESH_IDSource>` containing edges along which proceeds the extrusion
PathShape: optional shape (edge or wire) which defines the sub-mesh of the mesh defined by *PathObject* if the mesh contains not only path segments, else it can be None
NodeStart: the first or the last node on the path. Defines the direction of extrusion
HasAngles: allows the shape to be rotated around the path
to get the resulting mesh in a helical fashion
Angles: list of angles
HasAngles: not used obsolete
Angles: list of angles in radians. Nodes at each extrusion step are rotated
around *basePoint*, additionally to previous steps.
LinearVariation: forces the computation of rotation angles as linear
variation of the given Angles along path steps
HasRefPoint: allows using the reference point
RefPoint: the reference 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.
RefPoint: optional scaling and rotation center (mass center of the extruded
elements by default). The User can specify any point as the Reference Point.
*RefPoint* can be either GEOM Vertex, [x,y,z] or :class:`SMESH.PointStruct`
MakeGroups: forces the generation of new groups from existing ones
ScaleFactors: optional scale factors to apply during extrusion
ScalesVariation: if *True*, *scaleFactors* are spread over all *NbOfSteps*,
else *scaleFactors* [i] is applied to nodes at the i-th extrusion step
Returns:
list of created :class:`groups <SMESH.SMESH_GroupBase>` and
@ -5597,15 +5630,18 @@ class Mesh(metaclass = MeshMeta):
if isinstance( RefPoint, list ):
if not RefPoint: RefPoint = [0,0,0]
RefPoint = SMESH.PointStruct( *RefPoint )
if isinstance( PathMesh, Mesh ):
PathMesh = PathMesh.GetMesh()
if isinstance( PathObject, Mesh ):
PathObject = PathObject.GetMesh()
Angles,AnglesParameters,hasVars = ParseAngles(Angles)
Parameters = AnglesParameters + var_separator + RefPoint.parameters
ScaleFactors,ScalesParameters,hasVars = ParseParameters(ScaleFactors)
Parameters = AnglesParameters + var_separator + \
RefPoint.parameters + var_separator + ScalesParameters
self.mesh.SetParameters(Parameters)
return self.editor.ExtrusionAlongPathObjects(Nodes, Edges, Faces,
PathMesh, PathShape, NodeStart,
PathObject, PathShape, NodeStart,
HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups)
HasRefPoint, RefPoint, MakeGroups,
ScaleFactors, ScalesVariation)
def ExtrusionAlongPathX(self, Base, Path, NodeStart,
HasAngles=False, Angles=[], LinearVariation=False,
@ -5619,9 +5655,9 @@ class Mesh(metaclass = MeshMeta):
Base: :class:`mesh, sub-mesh, group, filter <SMESH.SMESH_IDSource>`, or list of ids of elements for extrusion
Path: 1D mesh or 1D sub-mesh, along which proceeds the extrusion
NodeStart: the start node from Path. Defines the direction of extrusion
HasAngles: allows the shape to be rotated around the path
to get the resulting mesh in a helical fashion
Angles: list of angles in radians
HasAngles: not used obsolete
Angles: list of angles in radians. Nodes at each extrusion step are rotated
around *basePoint*, additionally to previous steps.
LinearVariation: forces the computation of rotation angles as linear
variation of the given Angles along path steps
HasRefPoint: allows using the reference point
@ -5662,9 +5698,9 @@ class Mesh(metaclass = MeshMeta):
PathMesh: mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion
PathShape: shape (edge) defines the sub-mesh for the path
NodeStart: the first or the last node on the edge. Defines the direction of extrusion
HasAngles: allows the shape to be rotated around the path
to get the resulting mesh in a helical fashion
Angles: list of angles in radians
HasAngles: not used obsolete
Angles: list of angles in radians. Nodes at each extrusion step are rotated
around *basePoint*, additionally to previous steps.
HasRefPoint: allows using the reference point
RefPoint: the reference 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.
@ -5703,9 +5739,9 @@ class Mesh(metaclass = MeshMeta):
PathMesh: mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
PathShape: shape (edge) defines the sub-mesh for the path
NodeStart: the first or the last node on the edge. Defines the direction of extrusion
HasAngles: allows the shape to be rotated around the path
to get the resulting mesh in a helical fashion
Angles: list of angles
HasAngles: not used obsolete
Angles: list of angles in radians. Nodes at each extrusion step are rotated
around *basePoint*, additionally to previous steps.
HasRefPoint: allows using the reference point
RefPoint: the reference 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.
@ -5741,9 +5777,9 @@ class Mesh(metaclass = MeshMeta):
PathMesh: mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
PathShape: shape (edge) defines the sub-mesh for the path
NodeStart: the first or the last node on the edge. Defines the direction of extrusion
HasAngles: allows the shape to be rotated around the path
to get the resulting mesh in a helical fashion
Angles: list of angles
HasAngles: not used obsolete
Angles: list of angles in radians. Nodes at each extrusion step are rotated
around *basePoint*, additionally to previous steps.
HasRefPoint: allows using the reference point
RefPoint: the reference 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.
@ -5779,9 +5815,9 @@ class Mesh(metaclass = MeshMeta):
PathMesh: mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
PathShape: shape (edge) defines the sub-mesh for the path
NodeStart: the first or the last node on the edge. Defines the direction of extrusion
HasAngles: allows the shape to be rotated around the path
to get the resulting mesh in a helical fashion
Angles: list of angles
HasAngles: not used obsolete
Angles: list of angles in radians. Nodes at each extrusion step are rotated
around *basePoint*, additionally to previous steps.
HasRefPoint: allows using the reference point
RefPoint: the reference 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.

View File

@ -32,10 +32,11 @@
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx"
#include "SMESH_Algo.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_ComputeError.hxx"
#include "SMESH_Block.hxx"
#include "SMESH_ComputeError.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
#include <Adaptor2d_Curve2d.hxx>
#include <BRepAdaptor_CompCurve.hxx>

View File

@ -36,6 +36,7 @@
#include "SMESH_Group.hxx"
#include "SMESH_HypoFilter.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_subMeshEventListener.hxx"

View File

@ -40,6 +40,7 @@
#include "SMESH_Mesh.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_OctreeNode.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_subMesh.hxx"
#include "Utils_SALOME_Exception.hxx"

View File

@ -33,6 +33,7 @@
#include "SMESH_Comment.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypoFilter.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
#include "StdMeshers_FaceSide.hxx"
#include "StdMeshers_ProjectionSource1D.hxx"

View File

@ -37,6 +37,7 @@
#include "SMESH_Hypothesis.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MeshAlgos.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_subMeshEventListener.hxx"

View File

@ -42,6 +42,7 @@
#include "SMESH_Gen.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MeshAlgos.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_Pattern.hxx"
#include "SMESH_subMesh.hxx"

View File

@ -31,6 +31,7 @@
#include "SMDS_MeshNode.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
#include "utilities.h"

View File

@ -43,6 +43,7 @@
#include "SMESH_MesherHelper.hxx"
#include "SMESH_ProxyMesh.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_subMeshEventListener.hxx"
#include "StdMeshers_FaceSide.hxx"
#include "StdMeshers_ViscousLayers2D.hxx"

View File

@ -38,6 +38,7 @@
#include "SMESH_Group.hxx"
#include "SMESH_HypoFilter.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_ProxyMesh.hxx"
#include "SMESH_Quadtree.hxx"