mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-12 09:40:35 +05:00
Implement sweep mesh elements along a path (PAL7218).
This commit is contained in:
parent
910f46272c
commit
5496cb6ab1
@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
#include <TopTools_ListOfShape.hxx>
|
#include <TopTools_ListOfShape.hxx>
|
||||||
|
#include <math.h>
|
||||||
#include <gp_Dir.hxx>
|
#include <gp_Dir.hxx>
|
||||||
#include <gp_Vec.hxx>
|
#include <gp_Vec.hxx>
|
||||||
#include <gp_Ax1.hxx>
|
#include <gp_Ax1.hxx>
|
||||||
@ -1943,11 +1944,13 @@ void SMESH_MeshEditor::ExtrusionSweep(set<const SMDS_MeshElement*> & theElems,
|
|||||||
// make new elements
|
// make new elements
|
||||||
sweepElement( aMesh, elem, newNodesItVec, newElemsMap[elem] );
|
sweepElement( aMesh, elem, newNodesItVec, newElemsMap[elem] );
|
||||||
}
|
}
|
||||||
|
|
||||||
makeWalls( aMesh, mapNewNodes, newElemsMap, mapElemNewNodes, theElems );
|
makeWalls( aMesh, mapNewNodes, newElemsMap, mapElemNewNodes, theElems );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//class : SMESH_MeshEditor_PathPoint
|
||||||
|
//purpose : auxiliary class
|
||||||
|
//=======================================================================
|
||||||
class SMESH_MeshEditor_PathPoint {
|
class SMESH_MeshEditor_PathPoint {
|
||||||
public:
|
public:
|
||||||
SMESH_MeshEditor_PathPoint() {
|
SMESH_MeshEditor_PathPoint() {
|
||||||
@ -1992,16 +1995,17 @@ protected:
|
|||||||
//function : ExtrusionAlongTrack
|
//function : ExtrusionAlongTrack
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
int SMESH_MeshEditor::ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & theElements,
|
SMESH_MeshEditor::Extrusion_Error
|
||||||
SMESH_subMesh* theTrack,
|
SMESH_MeshEditor::ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & theElements,
|
||||||
const SMDS_MeshNode* theN1,
|
SMESH_subMesh* theTrack,
|
||||||
const bool theHasAngles,
|
const SMDS_MeshNode* theN1,
|
||||||
std::list<double>& theAngles,
|
const bool theHasAngles,
|
||||||
const bool theHasRefPoint,
|
std::list<double>& theAngles,
|
||||||
const gp_Pnt& theRefPoint)
|
const bool theHasRefPoint,
|
||||||
|
const gp_Pnt& theRefPoint)
|
||||||
{
|
{
|
||||||
MESSAGE("SMESH_MeshEditor::ExtrusionAlongTrack")
|
MESSAGE("SMESH_MeshEditor::ExtrusionAlongTrack")
|
||||||
int j, iErr, aNbTP, aNbAngles, aNbE, aNb;
|
int j, aNbTP, aNbE, aNb;
|
||||||
double aT1, aT2, aT, aAngle, aX, aY, aZ;
|
double aT1, aT2, aT, aAngle, aX, aY, aZ;
|
||||||
std::list<double> aPrms;
|
std::list<double> aPrms;
|
||||||
std::list<double>::iterator aItD;
|
std::list<double>::iterator aItD;
|
||||||
@ -2025,83 +2029,67 @@ int SMESH_MeshEditor::ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & t
|
|||||||
|
|
||||||
aTolVec=1.e-7;
|
aTolVec=1.e-7;
|
||||||
aTolVec2=aTolVec*aTolVec;
|
aTolVec2=aTolVec*aTolVec;
|
||||||
iErr=0;
|
|
||||||
|
|
||||||
// 1. Check data
|
// 1. Check data
|
||||||
aNbE=theElements.size();
|
aNbE = theElements.size();
|
||||||
if ( !aNbE ) {
|
// nothing to do
|
||||||
iErr = 10; // nothing to do
|
if ( !aNbE )
|
||||||
return iErr;
|
return EXTR_NO_ELEMENTS;
|
||||||
}
|
|
||||||
|
|
||||||
// 1.1 Track Pattern
|
// 1.1 Track Pattern
|
||||||
ASSERT( theTrack );
|
ASSERT( theTrack );
|
||||||
|
|
||||||
SMESHDS_SubMesh* pSubMeshDS=theTrack->GetSubMeshDS();
|
SMESHDS_SubMesh* pSubMeshDS=theTrack->GetSubMeshDS();
|
||||||
|
|
||||||
if ( !pSubMeshDS->Contains( theN1 ) ) {
|
|
||||||
iErr = 2; // No match found for start node
|
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
|
|
||||||
aItE = pSubMeshDS->GetElements();
|
aItE = pSubMeshDS->GetElements();
|
||||||
while ( aItE->more() ) {
|
while ( aItE->more() ) {
|
||||||
const SMDS_MeshElement* pE = aItE->next();
|
const SMDS_MeshElement* pE = aItE->next();
|
||||||
aTypeE = pE->GetType();
|
aTypeE = pE->GetType();
|
||||||
if ( aTypeE != SMDSAbs_Edge ) {
|
// Pattern must contain links only
|
||||||
iErr = 3; // Pattern must contain links only
|
if ( aTypeE != SMDSAbs_Edge )
|
||||||
return iErr;
|
return EXTR_PATH_NOT_EDGE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const TopoDS_Shape& aS = theTrack->GetSubShape();
|
const TopoDS_Shape& aS = theTrack->GetSubShape();
|
||||||
if ( aS.ShapeType() != TopAbs_EDGE) {
|
// Sub shape for the Pattern must be an Edge
|
||||||
iErr = 3; // Sub shape for the Pattern must be an Edge
|
if ( aS.ShapeType() != TopAbs_EDGE )
|
||||||
return iErr;
|
return EXTR_BAD_PATH_SHAPE;
|
||||||
aTrackEdge = TopoDS::Edge( aS );
|
|
||||||
if ( BRep_Tool::Degenerated( aTrackEdge ) ) {
|
aTrackEdge = TopoDS::Edge( aS );
|
||||||
iErr = 4; // the Edge must not be degenerated
|
// the Edge must not be degenerated
|
||||||
return iErr;
|
if ( BRep_Tool::Degenerated( aTrackEdge ) )
|
||||||
}
|
return EXTR_BAD_PATH_SHAPE;
|
||||||
}
|
|
||||||
|
|
||||||
TopExp::Vertices( aTrackEdge, aV1, aV2 );
|
TopExp::Vertices( aTrackEdge, aV1, aV2 );
|
||||||
aT1=BRep_Tool::Parameter( aV1, aTrackEdge );
|
aT1=BRep_Tool::Parameter( aV1, aTrackEdge );
|
||||||
aT2=BRep_Tool::Parameter( aV2, aTrackEdge );
|
aT2=BRep_Tool::Parameter( aV2, aTrackEdge );
|
||||||
|
|
||||||
aItN = myMesh->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes();
|
aItN = theTrack->GetFather()->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes();
|
||||||
const SMDS_MeshNode* aN1 = aItN->next();
|
const SMDS_MeshNode* aN1 = aItN->next();
|
||||||
|
|
||||||
aItN = myMesh->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes();
|
aItN = theTrack->GetFather()->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes();
|
||||||
const SMDS_MeshNode* aN2 = aItN->next();
|
const SMDS_MeshNode* aN2 = aItN->next();
|
||||||
|
|
||||||
if ( !( aN1 == theN1 || aN2 == theN1 ) ) {
|
// starting node must be aN1 or aN2
|
||||||
iErr = 5; // starting node must be aN1 or aN2
|
if ( !( aN1 == theN1 || aN2 == theN1 ) )
|
||||||
return iErr;
|
return EXTR_BAD_STARTING_NODE;
|
||||||
}
|
|
||||||
|
|
||||||
aNbTP = pSubMeshDS->NbNodes() + 2;
|
aNbTP = pSubMeshDS->NbNodes() + 2;
|
||||||
|
|
||||||
// 1.2. Angles
|
// 1.2. Angles
|
||||||
vector<double> aAngles( aNbTP );
|
vector<double> aAngles( aNbTP );
|
||||||
|
|
||||||
|
for ( j=0; j < aNbTP; ++j ) {
|
||||||
|
aAngles[j] = 0.;
|
||||||
|
}
|
||||||
|
|
||||||
if ( theHasAngles ) {
|
if ( theHasAngles ) {
|
||||||
aNbAngles = theAngles.size();
|
|
||||||
if ( aNbTP != aNbAngles ) {
|
|
||||||
iErr = 6; // number of Angles does not match to the number of track points
|
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
aItD = theAngles.begin();
|
aItD = theAngles.begin();
|
||||||
for ( j=0; aItD != aPrms.end(); ++aItD, ++j ) {
|
for ( j=0; (aItD != theAngles.end()) && (j<aNbTP); ++aItD, ++j ) {
|
||||||
aAngle = *aItD;
|
aAngle = *aItD;
|
||||||
aAngles[j] = aAngle;
|
aAngles[j] = aAngle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
for ( j=0; j < aNbTP; ++j ) {
|
|
||||||
aAngles[j] = 0.;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Collect parameters on the track edge
|
// 2. Collect parameters on the track edge
|
||||||
aPrms.push_back( aT1 );
|
aPrms.push_back( aT1 );
|
||||||
@ -2140,10 +2128,9 @@ int SMESH_MeshEditor::ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & t
|
|||||||
aT = *aItD;
|
aT = *aItD;
|
||||||
aC3D->D1( aT, aP3D, aVec );
|
aC3D->D1( aT, aP3D, aVec );
|
||||||
aL2 = aVec.SquareMagnitude();
|
aL2 = aVec.SquareMagnitude();
|
||||||
if ( aL2 < aTolVec2 ) {
|
if ( aL2 < aTolVec2 )
|
||||||
iErr = 20; // can not obtain the tangent;
|
return EXTR_CANT_GET_TANGENT;
|
||||||
return iErr;
|
|
||||||
}
|
|
||||||
gp_Dir aTgt( aVec );
|
gp_Dir aTgt( aVec );
|
||||||
aAngle = aAngles[j];
|
aAngle = aAngles[j];
|
||||||
|
|
||||||
@ -2214,23 +2201,27 @@ int SMESH_MeshEditor::ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & t
|
|||||||
// make new nodes
|
// make new nodes
|
||||||
aX = node->X(); aY = node->Y(); aZ = node->Z();
|
aX = node->X(); aY = node->Y(); aZ = node->Z();
|
||||||
|
|
||||||
Standard_Real aAngle1x;
|
Standard_Real aAngle1x, aAngleT1T0, aTolAng;
|
||||||
gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x;
|
gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x;
|
||||||
gp_Ax1 anAx1;
|
gp_Ax1 anAx1, anAxT1T0;
|
||||||
|
gp_Dir aDT1x, aDT0x, aDT1T0;
|
||||||
|
|
||||||
|
aTolAng=1.e-4;
|
||||||
|
|
||||||
aV0x = aV0;
|
aV0x = aV0;
|
||||||
aPN0.SetCoord(aX, aY, aZ);
|
aPN0.SetCoord(aX, aY, aZ);
|
||||||
|
|
||||||
const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0];
|
const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0];
|
||||||
aP0x = aPP0.Pnt();
|
aP0x = aPP0.Pnt();
|
||||||
|
aDT0x= aPP0.Tangent();
|
||||||
|
|
||||||
for ( j = 1; j < aNbTP; ++j ) {
|
for ( j = 1; j < aNbTP; ++j ) {
|
||||||
const SMESH_MeshEditor_PathPoint& aPP1 = aPPs[j];
|
const SMESH_MeshEditor_PathPoint& aPP1 = aPPs[j];
|
||||||
aP1x = aPP1.Pnt();
|
aP1x = aPP1.Pnt();
|
||||||
const gp_Dir& aDT1x = aPP1.Tangent();
|
aDT1x = aPP1.Tangent();
|
||||||
aAngle1x = aPP1.Angle();
|
aAngle1x = aPP1.Angle();
|
||||||
|
|
||||||
gp_Trsf aTrsf, aTrsfRot;
|
gp_Trsf aTrsf, aTrsfRot, aTrsfRotT1T0;
|
||||||
// Translation
|
// Translation
|
||||||
gp_Vec aV01x( aP0x, aP1x );
|
gp_Vec aV01x( aP0x, aP1x );
|
||||||
aTrsf.SetTranslation( aV01x );
|
aTrsf.SetTranslation( aV01x );
|
||||||
@ -2239,6 +2230,18 @@ int SMESH_MeshEditor::ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & t
|
|||||||
aV1x = aV0x.Transformed( aTrsf );
|
aV1x = aV0x.Transformed( aTrsf );
|
||||||
aPN1 = aPN0.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 ) {
|
if ( theHasAngles ) {
|
||||||
anAx1.SetLocation( aV1x );
|
anAx1.SetLocation( aV1x );
|
||||||
anAx1.SetDirection( aDT1x );
|
anAx1.SetDirection( aDT1x );
|
||||||
@ -2249,14 +2252,15 @@ int SMESH_MeshEditor::ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & t
|
|||||||
|
|
||||||
// make new node
|
// make new node
|
||||||
aX = aPN1.X();
|
aX = aPN1.X();
|
||||||
aY = aPN1.X();
|
aY = aPN1.Y();
|
||||||
aZ = aPN1.X();
|
aZ = aPN1.Z();
|
||||||
const SMDS_MeshNode* newNode = aMesh->AddNode( aX, aY, aZ );
|
const SMDS_MeshNode* newNode = aMesh->AddNode( aX, aY, aZ );
|
||||||
listNewNodes.push_back( newNode );
|
listNewNodes.push_back( newNode );
|
||||||
|
|
||||||
aPN0 = aPN1;
|
aPN0 = aPN1;
|
||||||
aP0x = aP1x;
|
aP0x = aP1x;
|
||||||
aV0x = aV1x;
|
aV0x = aV1x;
|
||||||
|
aDT0x = aDT1x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newNodesItVec.push_back( nIt );
|
newNodesItVec.push_back( nIt );
|
||||||
@ -2266,7 +2270,8 @@ int SMESH_MeshEditor::ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & t
|
|||||||
}
|
}
|
||||||
|
|
||||||
makeWalls( aMesh, mapNewNodes, newElemsMap, mapElemNewNodes, theElements );
|
makeWalls( aMesh, mapNewNodes, newElemsMap, mapElemNewNodes, theElements );
|
||||||
return iErr;
|
|
||||||
|
return EXTR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -122,13 +122,23 @@ class SMESH_MeshEditor {
|
|||||||
// Generate new elements by extrusion of theElements
|
// Generate new elements by extrusion of theElements
|
||||||
// by theStep by theNbSteps
|
// by theStep by theNbSteps
|
||||||
|
|
||||||
int ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & theElements,
|
enum Extrusion_Error {
|
||||||
SMESH_subMesh* theTrackPattern,
|
EXTR_OK,
|
||||||
const SMDS_MeshNode* theNodeStart,
|
EXTR_NO_ELEMENTS,
|
||||||
const bool theHasAngles,
|
EXTR_PATH_NOT_EDGE,
|
||||||
std::list<double>& theAngles,
|
EXTR_BAD_PATH_SHAPE,
|
||||||
const bool theHasRefPoint,
|
EXTR_BAD_STARTING_NODE,
|
||||||
const gp_Pnt& theRefPoint);
|
EXTR_BAD_ANGLES_NUMBER,
|
||||||
|
EXTR_CANT_GET_TANGENT
|
||||||
|
};
|
||||||
|
|
||||||
|
Extrusion_Error ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & theElements,
|
||||||
|
SMESH_subMesh* theTrackPattern,
|
||||||
|
const SMDS_MeshNode* theNodeStart,
|
||||||
|
const bool theHasAngles,
|
||||||
|
std::list<double>& theAngles,
|
||||||
|
const bool theHasRefPoint,
|
||||||
|
const gp_Pnt& theRefPoint);
|
||||||
// Generate new elements by extrusion of theElements along path given by theTrackPattern,
|
// Generate new elements by extrusion of theElements along path given by theTrackPattern,
|
||||||
// theHasAngles are the rotation angles, base point can be given by theRefPoint
|
// theHasAngles are the rotation angles, base point can be given by theRefPoint
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ class SMESH_subMesh
|
|||||||
// bool Contains(const TopoDS_Shape & aSubShape)
|
// bool Contains(const TopoDS_Shape & aSubShape)
|
||||||
// throw (SALOME_Exception);
|
// throw (SALOME_Exception);
|
||||||
|
|
||||||
|
SMESH_Mesh* GetFather() { return _father; }
|
||||||
|
|
||||||
SMESHDS_SubMesh * GetSubMeshDS();
|
SMESHDS_SubMesh * GetSubMeshDS();
|
||||||
|
|
||||||
SMESHDS_SubMesh* CreateSubMeshDS();
|
SMESHDS_SubMesh* CreateSubMeshDS();
|
||||||
|
@ -579,9 +579,9 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
|||||||
int j = 0;
|
int j = 0;
|
||||||
bool bOk;
|
bool bOk;
|
||||||
for ( int i = 0; i < AnglesList->count(); i++ ) {
|
for ( int i = 0; i < AnglesList->count(); i++ ) {
|
||||||
long angle = AnglesList->text( i ).toLong( &bOk );
|
double angle = AnglesList->text( i ).toDouble( &bOk );
|
||||||
if ( bOk )
|
if ( bOk )
|
||||||
anAngles[ j++ ] = angle;
|
anAngles[ j++ ] = angle*PI/180;
|
||||||
}
|
}
|
||||||
anAngles->length( j );
|
anAngles->length( j );
|
||||||
}
|
}
|
||||||
@ -597,9 +597,52 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
|||||||
try {
|
try {
|
||||||
QAD_WaitCursor wc;
|
QAD_WaitCursor wc;
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
aMeshEditor->ExtrusionAlongPath( anElementsId.inout(), myPathMesh, myPathShape, aNodeStart,
|
SMESH::SMESH_MeshEditor::Extrusion_Error retVal =
|
||||||
AnglesCheck->isChecked(), anAngles.inout(),
|
aMeshEditor->ExtrusionAlongPath( anElementsId.inout(), myPathMesh, myPathShape, aNodeStart,
|
||||||
BasePointCheck->isChecked(), aBasePoint );
|
AnglesCheck->isChecked(), anAngles.inout(),
|
||||||
|
BasePointCheck->isChecked(), aBasePoint );
|
||||||
|
|
||||||
|
wc.stop();
|
||||||
|
switch ( retVal ) {
|
||||||
|
case SMESH::SMESH_MeshEditor::EXTR_NO_ELEMENTS:
|
||||||
|
QAD_MessageBox::warn1( QAD_Application::getDesktop(),
|
||||||
|
tr( "SMESH_ERROR" ),
|
||||||
|
tr( "NO_ELEMENTS_SELECTED" ),
|
||||||
|
tr( "SMESH_BUT_OK" ) );
|
||||||
|
return false; break;
|
||||||
|
case SMESH::SMESH_MeshEditor::EXTR_PATH_NOT_EDGE:
|
||||||
|
QAD_MessageBox::warn1( QAD_Application::getDesktop(),
|
||||||
|
tr( "SMESH_ERROR" ),
|
||||||
|
tr( "SELECTED_PATH_IS_NOT_EDGE" ),
|
||||||
|
tr( "SMESH_BUT_OK" ) );
|
||||||
|
return false; break;
|
||||||
|
case SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE:
|
||||||
|
QAD_MessageBox::warn1( QAD_Application::getDesktop(),
|
||||||
|
tr( "SMESH_ERROR" ),
|
||||||
|
tr( "BAD_SHAPE_TYPE" ),
|
||||||
|
tr( "SMESH_BUT_OK" ) );
|
||||||
|
return false; break;
|
||||||
|
case SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE:
|
||||||
|
QAD_MessageBox::warn1( QAD_Application::getDesktop(),
|
||||||
|
tr( "SMESH_ERROR" ),
|
||||||
|
tr( "EXTR_BAD_STARTING_NODE" ),
|
||||||
|
tr( "SMESH_BUT_OK" ) );
|
||||||
|
return false; break;
|
||||||
|
case SMESH::SMESH_MeshEditor::EXTR_BAD_ANGLES_NUMBER:
|
||||||
|
QAD_MessageBox::warn1( QAD_Application::getDesktop(),
|
||||||
|
tr( "SMESH_ERROR" ),
|
||||||
|
tr( "WRONG_ANGLES_NUMBER" ),
|
||||||
|
tr( "SMESH_BUT_OK" ) );
|
||||||
|
return false; break;
|
||||||
|
case SMESH::SMESH_MeshEditor::EXTR_CANT_GET_TANGENT:
|
||||||
|
QAD_MessageBox::warn1( QAD_Application::getDesktop(),
|
||||||
|
tr( "SMESH_ERROR" ),
|
||||||
|
tr( "CANT_GET_TANGENT" ),
|
||||||
|
tr( "SMESH_BUT_OK" ) );
|
||||||
|
return false; break;
|
||||||
|
case SMESH::SMESH_MeshEditor::EXTR_OK:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch( ... ) {
|
catch( ... ) {
|
||||||
return false;
|
return false;
|
||||||
@ -937,14 +980,11 @@ void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument( QToolButton* button
|
|||||||
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
|
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
|
||||||
|
|
||||||
if ( !myPathMesh->_is_nil() ) {
|
if ( !myPathMesh->_is_nil() ) {
|
||||||
TColStd_MapOfInteger aTypes;
|
|
||||||
aTypes.Add( TopAbs_EDGE );
|
|
||||||
aTypes.Add( TopAbs_WIRE );
|
|
||||||
GEOM::GEOM_Object_var aMainShape = myPathMesh->GetShapeToMesh();
|
GEOM::GEOM_Object_var aMainShape = myPathMesh->GetShapeToMesh();
|
||||||
SMESH_Actor* aPathActor = SMESH::FindActorByObject( myPathMesh );
|
SMESH_Actor* aPathActor = SMESH::FindActorByObject( myPathMesh );
|
||||||
|
|
||||||
if ( !aMainShape->_is_nil() && aPathActor )
|
if ( !aMainShape->_is_nil() && aPathActor )
|
||||||
mySelection->AddFilter( new SMESH_NumberFilter( "GEOM", TopAbs_SHAPE, -1, aTypes, aMainShape ) );
|
mySelection->AddFilter( new SMESH_NumberFilter( "GEOM", TopAbs_SHAPE, -1, TopAbs_EDGE, aMainShape ) );
|
||||||
//SMESH::SetPickable( aPathActor );
|
//SMESH::SetPickable( aPathActor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1476,6 +1476,24 @@ msgstr "Use Base Point"
|
|||||||
msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_BASE_POINT"
|
msgid "SMESHGUI_ExtrusionAlongPathDlg::SMESH_BASE_POINT"
|
||||||
msgstr "Base Point"
|
msgstr "Base Point"
|
||||||
|
|
||||||
|
msgid "SMESHGUI_ExtrusionAlongPathDlg::NO_ELEMENTS_SELECTED"
|
||||||
|
msgstr "No mesh elements are selected for extrusion"
|
||||||
|
|
||||||
|
msgid "SMESHGUI_ExtrusionAlongPathDlg::SELECTED_PATH_IS_NOT_EDGE"
|
||||||
|
msgstr "Path mesh should be of edge type"
|
||||||
|
|
||||||
|
msgid "SMESHGUI_ExtrusionAlongPathDlg::BAD_SHAPE_TYPE"
|
||||||
|
msgstr "The shape selected for the path is not edge"
|
||||||
|
|
||||||
|
msgid "SMESHGUI_ExtrusionAlongPathDlg::EXTR_BAD_STARTING_NODE"
|
||||||
|
msgstr "Wrong path starting node"
|
||||||
|
|
||||||
|
msgid "SMESHGUI_ExtrusionAlongPathDlg::WRONG_ANGLES_NUMBER"
|
||||||
|
msgstr "The number of angles should correspond to the number of path nodes"
|
||||||
|
|
||||||
|
msgid "SMESHGUI_ExtrusionAlongPathDlg::CANT_GET_TANGENT"
|
||||||
|
msgstr "Can't get tangent for one of the path nodes"
|
||||||
|
|
||||||
#----------------------------------------------------
|
#----------------------------------------------------
|
||||||
|
|
||||||
msgid "SMESHGUI_RevolutionDlg::REVOLUTION_AROUND_AXIS"
|
msgid "SMESHGUI_RevolutionDlg::REVOLUTION_AROUND_AXIS"
|
||||||
|
@ -533,35 +533,52 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObjec
|
|||||||
ExtrusionSweep(anElementsId, theStepVector, theNbOfSteps);
|
ExtrusionSweep(anElementsId, theStepVector, theNbOfSteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#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 );
|
||||||
|
}
|
||||||
|
return SMESH::SMESH_MeshEditor::EXTR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ExtrusionAlongPath
|
//function : ExtrusionAlongPath
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array & theIDsOfElements,
|
SMESH::SMESH_MeshEditor::Extrusion_Error
|
||||||
SMESH::SMESH_Mesh_ptr thePathMesh,
|
SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array & theIDsOfElements,
|
||||||
GEOM::GEOM_Object_ptr thePathShape,
|
SMESH::SMESH_Mesh_ptr thePathMesh,
|
||||||
CORBA::Long theNodeStart,
|
GEOM::GEOM_Object_ptr thePathShape,
|
||||||
CORBA::Boolean theHasAngles,
|
CORBA::Long theNodeStart,
|
||||||
const SMESH::double_array & theAngles,
|
CORBA::Boolean theHasAngles,
|
||||||
CORBA::Boolean theHasRefPoint,
|
const SMESH::double_array & theAngles,
|
||||||
const SMESH::PointStruct & theRefPoint)
|
CORBA::Boolean theHasRefPoint,
|
||||||
|
const SMESH::PointStruct & theRefPoint)
|
||||||
{
|
{
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
|
|
||||||
if ( thePathMesh->_is_nil() || thePathShape->_is_nil() )
|
if ( thePathMesh->_is_nil() || thePathShape->_is_nil() )
|
||||||
return;
|
return SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
|
||||||
|
|
||||||
SMESH_Mesh_i* aMeshImp = dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( thePathMesh ).in() );
|
SMESH_Mesh_i* aMeshImp = dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( thePathMesh ).in() );
|
||||||
TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape );
|
TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape );
|
||||||
SMESH_subMesh* aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape );
|
SMESH_subMesh* aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape );
|
||||||
|
|
||||||
if ( !aSubMesh )
|
if ( !aSubMesh )
|
||||||
return;
|
return SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
|
||||||
|
|
||||||
SMDS_MeshNode* nodeStart = (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(theNodeStart);
|
SMDS_MeshNode* nodeStart = (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(theNodeStart);
|
||||||
if ( !nodeStart )
|
if ( !nodeStart )
|
||||||
return;
|
return SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
|
||||||
|
|
||||||
set<const SMDS_MeshElement*> elements;
|
set<const SMDS_MeshElement*> elements;
|
||||||
for (int i = 0; i < theIDsOfElements.length(); i++)
|
for (int i = 0; i < theIDsOfElements.length(); i++)
|
||||||
@ -581,7 +598,7 @@ void SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array & theIDsOf
|
|||||||
gp_Pnt refPnt( theRefPoint.x, theRefPoint.y, theRefPoint.z );
|
gp_Pnt refPnt( theRefPoint.x, theRefPoint.y, theRefPoint.z );
|
||||||
|
|
||||||
::SMESH_MeshEditor anEditor( _myMesh );
|
::SMESH_MeshEditor anEditor( _myMesh );
|
||||||
int res = anEditor.ExtrusionAlongTrack( elements, aSubMesh, nodeStart, theHasAngles, angles, theHasRefPoint, refPnt );
|
return convExtrError( anEditor.ExtrusionAlongTrack( elements, aSubMesh, nodeStart, theHasAngles, angles, theHasRefPoint, refPnt ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -589,17 +606,18 @@ void SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array & theIDsOf
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
|
SMESH::SMESH_MeshEditor::Extrusion_Error
|
||||||
SMESH::SMESH_Mesh_ptr thePathMesh,
|
SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
|
||||||
GEOM::GEOM_Object_ptr thePathShape,
|
SMESH::SMESH_Mesh_ptr thePathMesh,
|
||||||
CORBA::Long theNodeStart,
|
GEOM::GEOM_Object_ptr thePathShape,
|
||||||
CORBA::Boolean theHasAngles,
|
CORBA::Long theNodeStart,
|
||||||
const SMESH::double_array & theAngles,
|
CORBA::Boolean theHasAngles,
|
||||||
CORBA::Boolean theHasRefPoint,
|
const SMESH::double_array & theAngles,
|
||||||
const SMESH::PointStruct & theRefPoint)
|
CORBA::Boolean theHasRefPoint,
|
||||||
|
const SMESH::PointStruct & theRefPoint)
|
||||||
{
|
{
|
||||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||||
ExtrusionAlongPath( anElementsId, thePathMesh, thePathShape, theNodeStart, theHasAngles, theAngles, theHasRefPoint, theRefPoint );
|
return ExtrusionAlongPath( anElementsId, thePathMesh, thePathShape, theNodeStart, theHasAngles, theAngles, theHasRefPoint, theRefPoint );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -815,7 +833,7 @@ void SMESH_MeshEditor_i::MergeEqualElements()
|
|||||||
|
|
||||||
#define RETCASE(enm) case ::SMESH_MeshEditor::enm: return SMESH::SMESH_MeshEditor::enm;
|
#define RETCASE(enm) case ::SMESH_MeshEditor::enm: return SMESH::SMESH_MeshEditor::enm;
|
||||||
|
|
||||||
SMESH::SMESH_MeshEditor::Sew_Error convError( const::SMESH_MeshEditor::Sew_Error e )
|
static SMESH::SMESH_MeshEditor::Sew_Error convError( const::SMESH_MeshEditor::Sew_Error e )
|
||||||
{
|
{
|
||||||
switch ( e ) {
|
switch ( e ) {
|
||||||
RETCASE( SEW_OK );
|
RETCASE( SEW_OK );
|
||||||
|
@ -105,23 +105,25 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
|
|||||||
const SMESH::DirStruct & StepVector,
|
const SMESH::DirStruct & StepVector,
|
||||||
CORBA::Long NbOfSteps);
|
CORBA::Long NbOfSteps);
|
||||||
|
|
||||||
void ExtrusionAlongPath(const SMESH::long_array & IDsOfElements,
|
SMESH::SMESH_MeshEditor::Extrusion_Error
|
||||||
SMESH::SMESH_Mesh_ptr PathMesh,
|
ExtrusionAlongPath(const SMESH::long_array & IDsOfElements,
|
||||||
GEOM::GEOM_Object_ptr PathShape,
|
SMESH::SMESH_Mesh_ptr PathMesh,
|
||||||
CORBA::Long NodeStart,
|
GEOM::GEOM_Object_ptr PathShape,
|
||||||
CORBA::Boolean HasAngles,
|
CORBA::Long NodeStart,
|
||||||
const SMESH::double_array & Angles,
|
CORBA::Boolean HasAngles,
|
||||||
CORBA::Boolean HasRefPoint,
|
const SMESH::double_array & Angles,
|
||||||
const SMESH::PointStruct & RefPoint);
|
CORBA::Boolean HasRefPoint,
|
||||||
|
const SMESH::PointStruct & RefPoint);
|
||||||
|
|
||||||
void ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
|
SMESH::SMESH_MeshEditor::Extrusion_Error
|
||||||
SMESH::SMESH_Mesh_ptr PathMesh,
|
ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
|
||||||
GEOM::GEOM_Object_ptr PathShape,
|
SMESH::SMESH_Mesh_ptr PathMesh,
|
||||||
CORBA::Long NodeStart,
|
GEOM::GEOM_Object_ptr PathShape,
|
||||||
CORBA::Boolean HasAngles,
|
CORBA::Long NodeStart,
|
||||||
const SMESH::double_array & Angles,
|
CORBA::Boolean HasAngles,
|
||||||
CORBA::Boolean HasRefPoint,
|
const SMESH::double_array & Angles,
|
||||||
const SMESH::PointStruct & RefPoint);
|
CORBA::Boolean HasRefPoint,
|
||||||
|
const SMESH::PointStruct & RefPoint);
|
||||||
|
|
||||||
void Mirror(const SMESH::long_array & IDsOfElements,
|
void Mirror(const SMESH::long_array & IDsOfElements,
|
||||||
const SMESH::AxisStruct & Axis,
|
const SMESH::AxisStruct & Axis,
|
||||||
|
Loading…
Reference in New Issue
Block a user