From: skl Date: Wed, 10 Jun 2009 07:09:15 +0000 (+0000) Subject: Implementation of new version ExtrusionAlongPath (20003 from Mantis). X-Git-Tag: V5_1_3rc1~163 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=34fb01e7b5b520e2193fd44c066322e970d471b1;p=modules%2Fsmesh.git Implementation of new version ExtrusionAlongPath (20003 from Mantis). --- diff --git a/doc/salome/gui/SMESH/images/extr_along_wire_after.png b/doc/salome/gui/SMESH/images/extr_along_wire_after.png new file mode 100644 index 000000000..eb39bdd08 Binary files /dev/null and b/doc/salome/gui/SMESH/images/extr_along_wire_after.png differ diff --git a/doc/salome/gui/SMESH/images/extr_along_wire_before.png b/doc/salome/gui/SMESH/images/extr_along_wire_before.png new file mode 100644 index 000000000..2f30ceeab Binary files /dev/null and b/doc/salome/gui/SMESH/images/extr_along_wire_before.png differ diff --git a/doc/salome/gui/SMESH/images/extrusion1.png b/doc/salome/gui/SMESH/images/extrusion1.png index 9f34a0feb..540bce24a 100644 Binary files a/doc/salome/gui/SMESH/images/extrusion1.png and b/doc/salome/gui/SMESH/images/extrusion1.png differ diff --git a/doc/salome/gui/SMESH/input/extrusion_along_path.doc b/doc/salome/gui/SMESH/input/extrusion_along_path.doc index 31174dde2..96f0e9f1a 100644 --- a/doc/salome/gui/SMESH/input/extrusion_along_path.doc +++ b/doc/salome/gui/SMESH/input/extrusion_along_path.doc @@ -4,13 +4,14 @@ \n In principle, Extrusion along a path works in the same way as \b Extrusion, the main difference is that we define not a vector, -but a path of extrusion which must be a meshed edge. To get an idea of -how this algorithm works, examine several examples, starting from the -most simple case of extrusion along a straight edge. In all examples -the same mesh will be extruded along different paths and with -different parameters. This sample 2D mesh has two quadrangle faces and -seven edges. Look at the picture, where white digits are the node -numbers and green are the element numbers: +but a path of extrusion which must be a 1D mesh or 1D sub-mesh. To +get an idea of how this algorithm works, examine several examples, +starting from the most simple case of extrusion along a straight edge. +In following examples the meshes will be extruded along different +paths and with different parameters. +This sample 2D mesh has two quadrangle faces and seven edges. Look +at the picture, where white digits are the node numbers and green +are the element numbers: \image html mesh_for_extr_along_path.png @@ -40,29 +41,15 @@ been selected as Start node. \image html curvi_angles_after.png
The same, but using angles {45, 45, 45, 0, -45, -45, -45}
-

Extrusion along a sub-mesh

+

Extrusion of 2d face along a mesh builds on wire

-In this example the path mesh has been built on a wire (polyline with -six edges). The first edge of the wire was used as Shape (edge), node -#1 as Start node. The angles have been defined as {10, 10, 10}. The -middle edge (#4) of the initial mesh has been extruded. +In this example the path mesh has been built on a wire contains 3 +edges. Node #1 is used as start node. Linear angle variation by 180 +degree is applied. -\image html edge_wire_before.png +\image html extr_along_wire_before.png -\image html edge_wire_after.png - -

Extrusion of 2d elements along a sub-mesh

- -This extrusion bases on the same path mesh as in the previous example -but the third edge of the wire was set as Shape (edge) and node -#4 as Start node. Please note, that the extrusion has been done -in direction from node #4 to node #3, i.e. against the wire -direction. In this example both faces of the initial mesh have been -extruded. - -\image html edge_wire_3d_before.png - -\image html edge_wire_3d_after.png +\image html extr_along_wire_after.png

Extrusion of 2d elements along a closed path

@@ -113,9 +100,8 @@ about filters in the \ref selection_filter_library_page "Selection filter librar
  • define the Path along which the elements will be extruded, \n Path definition consists of several elements:
  • activate Generate Groups checkbox if it is necessary to copy the groups of diff --git a/idl/SMESH_MeshEditor.idl b/idl/SMESH_MeshEditor.idl index 0a4b5b7cd..21ea8a5dd 100644 --- a/idl/SMESH_MeshEditor.idl +++ b/idl/SMESH_MeshEditor.idl @@ -392,6 +392,30 @@ module SMESH EXTR_CANT_GET_TANGENT }; + ListOfGroups ExtrusionAlongPathX(in long_array IDsOfElements, + in SMESH_IDSource Path, + in long NodeStart, + in boolean HasAngles, + in double_array Angles, + in boolean LinearVariation, + in boolean HasRefPoint, + in PointStruct RefPoint, + in boolean MakeGroups, + in ElementType ElemType, + out Extrusion_Error Error); + + ListOfGroups ExtrusionAlongPathObjX(in SMESH_IDSource theObject, + in SMESH_IDSource Path, + in long NodeStart, + in boolean HasAngles, + in double_array Angles, + in boolean LinearVariation, + in boolean HasRefPoint, + in PointStruct RefPoint, + in boolean MakeGroups, + in ElementType ElemType, + out Extrusion_Error Error); + Extrusion_Error ExtrusionAlongPath(in long_array IDsOfElements, in SMESH_Mesh PathMesh, in GEOM::GEOM_Object PathShape, diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index 18ae0388b..81d71320c 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -3732,7 +3733,7 @@ SMESH_MeshEditor::ExtrusionSweep (TIDSortedElemSet & theElems, return newGroupIDs; } - +/* //======================================================================= //class : SMESH_MeshEditor_PathPoint //purpose : auxiliary class @@ -3776,6 +3777,7 @@ protected: double myAngle; double myPrm; }; +*/ //======================================================================= //function : ExtrusionAlongTrack @@ -3787,6 +3789,7 @@ SMESH_MeshEditor::Extrusion_Error const SMDS_MeshNode* theN1, const bool theHasAngles, list& theAngles, + const bool theLinearVariation, const bool theHasRefPoint, const gp_Pnt& theRefPoint, const bool theMakeGroups) @@ -3794,20 +3797,11 @@ SMESH_MeshEditor::Extrusion_Error myLastCreatedElems.Clear(); myLastCreatedNodes.Clear(); - // source elements for each generated one - SMESH_SequenceOfElemPtr srcElems, srcNodes; - - int j, aNbTP, aNbE, aNb; - double aT1, aT2, aT, aAngle, aX, aY, aZ; + int aNbE; std::list aPrms; - std::list::iterator aItD; TIDSortedElemSet::iterator itElem; - Standard_Real aTx1, aTx2, aL2, aTolVec, aTolVec2; - gp_Pnt aP3D, aV0; - gp_Vec aVec; gp_XYZ aGC; - Handle(Geom_Curve) aC3D; TopoDS_Edge aTrackEdge; TopoDS_Vertex aV1, aV2; @@ -3816,11 +3810,6 @@ SMESH_MeshEditor::Extrusion_Error SMDSAbs_ElementType aTypeE; TNodeOfNodeListMap mapNewNodes; - TElemOfVecOfNnlmiMap mapElemNewNodes; - TElemOfElemListMap newElemsMap; - - aTolVec=1.e-7; - aTolVec2=aTolVec*aTolVec; // 1. Check data aNbE = theElements.size(); @@ -3831,7 +3820,7 @@ SMESH_MeshEditor::Extrusion_Error // 1.1 Track Pattern ASSERT( theTrack ); - SMESHDS_SubMesh* pSubMeshDS=theTrack->GetSubMeshDS(); + SMESHDS_SubMesh* pSubMeshDS = theTrack->GetSubMeshDS(); aItE = pSubMeshDS->GetElements(); while ( aItE->more() ) { @@ -3842,63 +3831,325 @@ SMESH_MeshEditor::Extrusion_Error return EXTR_PATH_NOT_EDGE; } + list fullList; + const TopoDS_Shape& aS = theTrack->GetSubShape(); - // Sub shape for the Pattern must be an Edge - if ( aS.ShapeType() != TopAbs_EDGE ) + // Sub shape for the Pattern must be an Edge or Wire + if( aS.ShapeType() == TopAbs_EDGE ) { + aTrackEdge = TopoDS::Edge( aS ); + // the Edge must not be degenerated + if ( BRep_Tool::Degenerated( aTrackEdge ) ) + return EXTR_BAD_PATH_SHAPE; + TopExp::Vertices( aTrackEdge, aV1, aV2 ); + aItN = theTrack->GetFather()->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode* aN1 = aItN->next(); + aItN = theTrack->GetFather()->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode* aN2 = aItN->next(); + // starting node must be aN1 or aN2 + if ( !( aN1 == theN1 || aN2 == theN1 ) ) + return EXTR_BAD_STARTING_NODE; + aItN = pSubMeshDS->GetNodes(); + while ( aItN->more() ) { + const SMDS_MeshNode* pNode = aItN->next(); + const SMDS_EdgePosition* pEPos = + static_cast( pNode->GetPosition().get() ); + double aT = pEPos->GetUParameter(); + aPrms.push_back( aT ); + } + Extrusion_Error err = MakeEdgePathPoints(aPrms, aTrackEdge, (aN1==theN1), fullList); + } + else if( aS.ShapeType() == TopAbs_WIRE ) { + list< SMESH_subMesh* > LSM; + TopTools_SequenceOfShape Edges; + SMESH_subMeshIteratorPtr itSM = theTrack->getDependsOnIterator(false,true); + while(itSM->more()) { + SMESH_subMesh* SM = itSM->next(); + LSM.push_back(SM); + const TopoDS_Shape& aS = SM->GetSubShape(); + Edges.Append(aS); + } + list< list > LLPPs; + int startNid = theN1->GetID(); + TColStd_MapOfInteger UsedNums; + int NbEdges = Edges.Length(); + int i = 1; + for(; i<=NbEdges; i++) { + int k = 0; + list< SMESH_subMesh* >::iterator itLSM = LSM.begin(); + for(; itLSM!=LSM.end(); itLSM++) { + k++; + if(UsedNums.Contains(k)) continue; + aTrackEdge = TopoDS::Edge( Edges.Value(k) ); + SMESH_subMesh* locTrack = *itLSM; + SMESHDS_SubMesh* locMeshDS = locTrack->GetSubMeshDS(); + TopExp::Vertices( aTrackEdge, aV1, aV2 ); + aItN = locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode* aN1 = aItN->next(); + aItN = locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode* aN2 = aItN->next(); + // starting node must be aN1 or aN2 + if ( !( aN1->GetID() == startNid || aN2->GetID() == startNid ) ) continue; + // 2. Collect parameters on the track edge + aPrms.clear(); + aItN = locMeshDS->GetNodes(); + while ( aItN->more() ) { + const SMDS_MeshNode* pNode = aItN->next(); + const SMDS_EdgePosition* pEPos = + static_cast( pNode->GetPosition().get() ); + double aT = pEPos->GetUParameter(); + aPrms.push_back( aT ); + } + list LPP; + Extrusion_Error err = MakeEdgePathPoints(aPrms, aTrackEdge, + (aN1->GetID()==startNid), LPP); + LLPPs.push_back(LPP); + UsedNums.Add(k); + // update startN for search following egde + if( aN1->GetID() == startNid ) startNid = aN2->GetID(); + else startNid = aN1->GetID(); + break; + } + } + list< list >::iterator itLLPP = LLPPs.begin(); + list firstList = *itLLPP; + list::iterator itPP = firstList.begin(); + for(; itPP!=firstList.end(); itPP++) { + fullList.push_back( *itPP ); + } + SMESH_MeshEditor_PathPoint PP1 = fullList.back(); + fullList.pop_back(); + itLLPP++; + for(; itLLPP!=LLPPs.end(); itLLPP++) { + list currList = *itLLPP; + itPP = currList.begin(); + SMESH_MeshEditor_PathPoint PP2 = currList.front(); + gp_Dir D1 = PP1.Tangent(); + gp_Dir D2 = PP2.Tangent(); + gp_Dir Dnew( gp_Vec( (D1.X()+D2.X())/2, (D1.Y()+D2.Y())/2, + (D1.Z()+D2.Z())/2 ) ); + PP1.SetTangent(Dnew); + fullList.push_back(PP1); + itPP++; + for(; itPP!=firstList.end(); itPP++) { + fullList.push_back( *itPP ); + } + PP1 = fullList.back(); + fullList.pop_back(); + } + // if wire not closed + fullList.push_back(PP1); + // else ??? + } + else { return EXTR_BAD_PATH_SHAPE; + } - aTrackEdge = TopoDS::Edge( aS ); - // the Edge must not be degenerated - if ( BRep_Tool::Degenerated( aTrackEdge ) ) - return EXTR_BAD_PATH_SHAPE; + return MakeExtrElements(theElements, fullList, theHasAngles, theAngles, theLinearVariation, + theHasRefPoint, theRefPoint, theMakeGroups); +} - TopExp::Vertices( aTrackEdge, aV1, aV2 ); - aT1=BRep_Tool::Parameter( aV1, aTrackEdge ); - aT2=BRep_Tool::Parameter( aV2, aTrackEdge ); - aItN = theTrack->GetFather()->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes(); - const SMDS_MeshNode* aN1 = aItN->next(); +//======================================================================= +//function : ExtrusionAlongTrack +//purpose : +//======================================================================= +SMESH_MeshEditor::Extrusion_Error + SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements, + SMESH_Mesh* theTrack, + const SMDS_MeshNode* theN1, + const bool theHasAngles, + list& theAngles, + const bool theLinearVariation, + const bool theHasRefPoint, + const gp_Pnt& theRefPoint, + const bool theMakeGroups) +{ + myLastCreatedElems.Clear(); + myLastCreatedNodes.Clear(); + + int aNbE; + std::list aPrms; + TIDSortedElemSet::iterator itElem; - aItN = theTrack->GetFather()->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes(); - const SMDS_MeshNode* aN2 = aItN->next(); + gp_XYZ aGC; + TopoDS_Edge aTrackEdge; + TopoDS_Vertex aV1, aV2; - // starting node must be aN1 or aN2 - if ( !( aN1 == theN1 || aN2 == theN1 ) ) - return EXTR_BAD_STARTING_NODE; + SMDS_ElemIteratorPtr aItE; + SMDS_NodeIteratorPtr aItN; + SMDSAbs_ElementType aTypeE; - aNbTP = pSubMeshDS->NbNodes() + 2; + TNodeOfNodeListMap mapNewNodes; - // 1.2. Angles - vector aAngles( aNbTP ); + // 1. Check data + aNbE = theElements.size(); + // nothing to do + if ( !aNbE ) + return EXTR_NO_ELEMENTS; - for ( j=0; j < aNbTP; ++j ) { - aAngles[j] = 0.; + // 1.1 Track Pattern + ASSERT( theTrack ); + + SMESHDS_Mesh* pMeshDS = theTrack->GetMeshDS(); + + aItE = pMeshDS->elementsIterator(); + while ( aItE->more() ) { + const SMDS_MeshElement* pE = aItE->next(); + aTypeE = pE->GetType(); + // Pattern must contain links only + if ( aTypeE != SMDSAbs_Edge ) + return EXTR_PATH_NOT_EDGE; } - if ( theHasAngles ) { - aItD = theAngles.begin(); - for ( j=1; (aItD != theAngles.end()) && (j fullList; + + const TopoDS_Shape& aS = theTrack->GetShapeToMesh(); + // Sub shape for the Pattern must be an Edge or Wire + if( aS.ShapeType() == TopAbs_EDGE ) { + aTrackEdge = TopoDS::Edge( aS ); + // the Edge must not be degenerated + if ( BRep_Tool::Degenerated( aTrackEdge ) ) + return EXTR_BAD_PATH_SHAPE; + TopExp::Vertices( aTrackEdge, aV1, aV2 ); + aItN = theTrack->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode* aN1 = aItN->next(); + aItN = theTrack->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode* aN2 = aItN->next(); + // starting node must be aN1 or aN2 + if ( !( aN1 == theN1 || aN2 == theN1 ) ) + return EXTR_BAD_STARTING_NODE; + aItN = pMeshDS->nodesIterator(); + while ( aItN->more() ) { + const SMDS_MeshNode* pNode = aItN->next(); + if( pNode==aN1 || pNode==aN2 ) continue; + const SMDS_EdgePosition* pEPos = + static_cast( pNode->GetPosition().get() ); + double aT = pEPos->GetUParameter(); + aPrms.push_back( aT ); + } + Extrusion_Error err = MakeEdgePathPoints(aPrms, aTrackEdge, (aN1==theN1), fullList); + } + else if( aS.ShapeType() == TopAbs_WIRE ) { + list< SMESH_subMesh* > LSM; + TopTools_SequenceOfShape Edges; + TopExp_Explorer eExp(aS, TopAbs_EDGE); + for(; eExp.More(); eExp.Next()) { + TopoDS_Edge E = TopoDS::Edge( eExp.Current() ); + if( BRep_Tool::Degenerated(E) ) continue; + SMESH_subMesh* SM = theTrack->GetSubMesh(E); + if(SM) { + LSM.push_back(SM); + Edges.Append(E); + } + } + list< list > LLPPs; + int startNid = theN1->GetID(); + TColStd_MapOfInteger UsedNums; + int NbEdges = Edges.Length(); + int i = 1; + for(; i<=NbEdges; i++) { + int k = 0; + list< SMESH_subMesh* >::iterator itLSM = LSM.begin(); + for(; itLSM!=LSM.end(); itLSM++) { + k++; + if(UsedNums.Contains(k)) continue; + aTrackEdge = TopoDS::Edge( Edges.Value(k) ); + SMESH_subMesh* locTrack = *itLSM; + SMESHDS_SubMesh* locMeshDS = locTrack->GetSubMeshDS(); + TopExp::Vertices( aTrackEdge, aV1, aV2 ); + aItN = locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode* aN1 = aItN->next(); + aItN = locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS()->GetNodes(); + const SMDS_MeshNode* aN2 = aItN->next(); + // starting node must be aN1 or aN2 + if ( !( aN1->GetID() == startNid || aN2->GetID() == startNid ) ) continue; + // 2. Collect parameters on the track edge + aPrms.clear(); + aItN = locMeshDS->GetNodes(); + while ( aItN->more() ) { + const SMDS_MeshNode* pNode = aItN->next(); + const SMDS_EdgePosition* pEPos = + static_cast( pNode->GetPosition().get() ); + double aT = pEPos->GetUParameter(); + aPrms.push_back( aT ); + } + list LPP; + Extrusion_Error err = MakeEdgePathPoints(aPrms, aTrackEdge, + (aN1->GetID()==startNid), LPP); + LLPPs.push_back(LPP); + UsedNums.Add(k); + // update startN for search following egde + if( aN1->GetID() == startNid ) startNid = aN2->GetID(); + else startNid = aN1->GetID(); + break; + } } + list< list >::iterator itLLPP = LLPPs.begin(); + list firstList = *itLLPP; + list::iterator itPP = firstList.begin(); + for(; itPP!=firstList.end(); itPP++) { + fullList.push_back( *itPP ); + } + SMESH_MeshEditor_PathPoint PP1 = fullList.back(); + fullList.pop_back(); + itLLPP++; + for(; itLLPP!=LLPPs.end(); itLLPP++) { + list currList = *itLLPP; + itPP = currList.begin(); + SMESH_MeshEditor_PathPoint PP2 = currList.front(); + gp_Pnt P1 = PP1.Pnt(); + //cout<<" PP1: Pnt("<GetNodes(); - while ( aItN->more() ) { - const SMDS_MeshNode* pNode = aItN->next(); - const SMDS_EdgePosition* pEPos = - static_cast( pNode->GetPosition().get() ); - aT = pEPos->GetUParameter(); - aPrms.push_back( aT ); - } +//======================================================================= +//function : MakeEdgePathPoints +//purpose : auxilary for ExtrusionAlongTrack +//======================================================================= +SMESH_MeshEditor::Extrusion_Error +SMESH_MeshEditor::MakeEdgePathPoints(std::list& aPrms, + const TopoDS_Edge& aTrackEdge, + bool FirstIsStart, + list& LPP) +{ + Standard_Real aTx1, aTx2, aL2, aTolVec, aTolVec2; + aTolVec=1.e-7; + aTolVec2=aTolVec*aTolVec; + double aT1, aT2; + TopoDS_Vertex aV1, aV2; + TopExp::Vertices( aTrackEdge, aV1, aV2 ); + aT1=BRep_Tool::Parameter( aV1, aTrackEdge ); + aT2=BRep_Tool::Parameter( aV2, aTrackEdge ); + // 2. Collect parameters on the track edge + aPrms.push_front( aT1 ); + aPrms.push_back( aT2 ); // sort parameters aPrms.sort(); - if ( aN1 == theN1 ) { + if( FirstIsStart ) { if ( aT1 > aT2 ) { aPrms.reverse(); } @@ -3908,48 +4159,100 @@ SMESH_MeshEditor::Extrusion_Error aPrms.reverse(); } } - // 3. Path Points SMESH_MeshEditor_PathPoint aPP; - vector aPPs( aNbTP ); - // - aC3D = BRep_Tool::Curve( aTrackEdge, aTx1, aTx2 ); - // - aItD = aPrms.begin(); - for ( j=0; aItD != aPrms.end(); ++aItD, ++j ) { - aT = *aItD; + Handle(Geom_Curve) aC3D = BRep_Tool::Curve( aTrackEdge, aTx1, aTx2 ); + std::list::iterator aItD = aPrms.begin(); + for(; aItD != aPrms.end(); ++aItD) { + double aT = *aItD; + gp_Pnt aP3D; + gp_Vec aVec; aC3D->D1( aT, aP3D, aVec ); aL2 = aVec.SquareMagnitude(); if ( aL2 < aTolVec2 ) return EXTR_CANT_GET_TANGENT; - gp_Dir aTgt( aVec ); - aAngle = aAngles[j]; - aPP.SetPnt( aP3D ); aPP.SetTangent( aTgt ); - aPP.SetAngle( aAngle ); aPP.SetParameter( aT ); - aPPs[j]=aPP; + LPP.push_back(aPP); + } +} + + +//======================================================================= +//function : MakeExtrElements +//purpose : auxilary for ExtrusionAlongTrack +//======================================================================= +SMESH_MeshEditor::Extrusion_Error +SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements, + list& fullList, + const bool theHasAngles, + list& theAngles, + const bool theLinearVariation, + const bool theHasRefPoint, + const gp_Pnt& theRefPoint, + const bool theMakeGroups) +{ + //cout<<"MakeExtrElements fullList.size() = "< aPPs(aNbTP); + // Angles + if( theHasAngles && theAngles.size()>0 && theLinearVariation ) { + LinearAngleVariation(aNbTP-1, theAngles); } + vector aAngles( aNbTP ); + int j = 0; + for(; j::iterator aItD = theAngles.begin(); + for ( j=1; (aItD != theAngles.end()) && (j::iterator itPP = fullList.begin(); + for(; itPP!=fullList.end(); itPP++) { + j++; + SMESH_MeshEditor_PathPoint PP = *itPP; + PP.SetAngle(aAngles[j]); + aPPs[j] = PP; + } + + TNodeOfNodeListMap mapNewNodes; + TElemOfVecOfNnlmiMap mapElemNewNodes; + TElemOfElemListMap newElemsMap; + TIDSortedElemSet::iterator itElem; + double aX, aY, aZ; + int aNb; + SMDSAbs_ElementType aTypeE; + // source elements for each generated one + SMESH_SequenceOfElemPtr srcElems, srcNodes; // 3. Center of rotation aV0 - aV0 = theRefPoint; + gp_Pnt aV0 = theRefPoint; + gp_XYZ aGC; if ( !theHasRefPoint ) { aNb = 0; aGC.SetCoord( 0.,0.,0. ); - + itElem = theElements.begin(); for ( ; itElem != theElements.end(); itElem++ ) { const SMDS_MeshElement* elem = *itElem; - + SMDS_ElemIteratorPtr itN = elem->nodesIterator(); while ( itN->more() ) { const SMDS_MeshNode* node = static_cast( itN->next() ); aX = node->X(); aY = node->Y(); aZ = node->Z(); - + if ( mapNewNodes.find( node ) == mapNewNodes.end() ) { list aLNx; mapNewNodes[node] = aLNx; @@ -4008,6 +4311,7 @@ SMESH_MeshEditor::Extrusion_Error const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0]; aP0x = aPP0.Pnt(); aDT0x= aPP0.Tangent(); + //cout<<"j = 0 PP: Pnt("<& Angles) +{ + int nbAngles = Angles.size(); + if( nbSteps > nbAngles ) { + vector theAngles(nbAngles); + list::iterator it = Angles.begin(); + int i = -1; + for(; it!=Angles.end(); it++) { + i++; + theAngles[i] = (*it); + } + list res; + double rAn2St = double( nbAngles ) / double( nbSteps ); + double angPrev = 0, angle; + for ( int iSt = 0; iSt < nbSteps; ++iSt ) { + double angCur = rAn2St * ( iSt+1 ); + double angCurFloor = floor( angCur ); + double angPrevFloor = floor( angPrev ); + if ( angPrevFloor == angCurFloor ) + angle = rAn2St * theAngles[ int( angCurFloor ) ]; + else { + int iP = int( angPrevFloor ); + double angPrevCeil = ceil(angPrev); + angle = ( angPrevCeil - angPrev ) * theAngles[ iP ]; + + int iC = int( angCurFloor ); + if ( iC < nbAngles ) + angle += ( angCur - angCurFloor ) * theAngles[ iC ]; + + iP = int( angPrevCeil ); + while ( iC-- > iP ) + angle += theAngles[ iC ]; + } + res.push_back(angle); + angPrev = angCur; + } + Angles.clear(); + it = res.begin(); + for(; it!=res.end(); it++) + Angles.push_back( *it ); + } +} + + //======================================================================= //function : Transform //purpose : diff --git a/src/SMESH/SMESH_MeshEditor.hxx b/src/SMESH/SMESH_MeshEditor.hxx index 06896059b..b92b62686 100644 --- a/src/SMESH/SMESH_MeshEditor.hxx +++ b/src/SMESH/SMESH_MeshEditor.hxx @@ -85,6 +85,53 @@ struct SMESH_NodeSearcher virtual const SMDS_MeshNode* FindClosestTo( const gp_Pnt& pnt ) = 0; }; + +//======================================================================= +/*! + * auxiliary class + */ +//======================================================================= +class SMESH_MeshEditor_PathPoint { +public: + SMESH_MeshEditor_PathPoint() { + myPnt.SetCoord(99., 99., 99.); + myTgt.SetCoord(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; + } + +protected: + gp_Pnt myPnt; + gp_Dir myTgt; + double myAngle; + double myPrm; +}; + + // ============================================================ /*! * \brief Editor of a mesh @@ -292,6 +339,16 @@ public: const SMDS_MeshNode* theNodeStart, const bool theHasAngles, std::list& theAngles, + const bool theLinearVariation, + const bool theHasRefPoint, + const gp_Pnt& theRefPoint, + const bool theMakeGroups); + Extrusion_Error ExtrusionAlongTrack (TIDSortedElemSet & theElements, + SMESH_Mesh* theTrackPattern, + const SMDS_MeshNode* theNodeStart, + const bool theHasAngles, + std::list& theAngles, + const bool theLinearVariation, const bool theHasRefPoint, const gp_Pnt& theRefPoint, const bool theMakeGroups); @@ -583,6 +640,25 @@ private: TIDSortedElemSet& elemSet, const int nbSteps, SMESH_SequenceOfElemPtr& srcElements); + + /*! + * auxilary for ExtrusionAlongTrack + */ + Extrusion_Error MakeEdgePathPoints(std::list& aPrms, + const TopoDS_Edge& aTrackEdge, + bool FirstIsStart, + list& LPP); + Extrusion_Error MakeExtrElements(TIDSortedElemSet& theElements, + list& fullList, + const bool theHasAngles, + list& theAngles, + const bool theLinearVariation, + const bool theHasRefPoint, + const gp_Pnt& theRefPoint, + const bool theMakeGroups); + void LinearAngleVariation(const int NbSteps, + list& theAngles); + private: SMESH_Mesh * myMesh; diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index a9af10b76..8d1d9c300 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -186,15 +186,6 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod PathMeshLineEdit = new QLineEdit(PathGrp); PathMeshLineEdit->setReadOnly(true); - // Controls for path shape selection - QLabel* PathShapeLab = new QLabel(tr("SMESH_PATH_SHAPE"), PathGrp); - - SelectPathShapeButton = new QToolButton(PathGrp); - SelectPathShapeButton->setIcon(selectImage); - - PathShapeLineEdit = new QLineEdit(PathGrp); - PathShapeLineEdit->setReadOnly(true); - // Controls for path starting point selection QLabel* StartPointLab = new QLabel(tr("SMESH_PATH_START"), PathGrp); @@ -208,12 +199,9 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod PathGrpLayout->addWidget(PathMeshLab, 0, 0); PathGrpLayout->addWidget(SelectPathMeshButton, 0, 1); PathGrpLayout->addWidget(PathMeshLineEdit, 0, 2); - PathGrpLayout->addWidget(PathShapeLab, 1, 0); - PathGrpLayout->addWidget(SelectPathShapeButton, 1, 1); - PathGrpLayout->addWidget(PathShapeLineEdit, 1, 2); - PathGrpLayout->addWidget(StartPointLab, 2, 0); - PathGrpLayout->addWidget(SelectStartPointButton, 2, 1); - PathGrpLayout->addWidget(StartPointLineEdit, 2, 2); + PathGrpLayout->addWidget(StartPointLab, 1, 0); + PathGrpLayout->addWidget(SelectStartPointButton, 1, 1); + PathGrpLayout->addWidget(StartPointLineEdit, 1, 2); BasePointGrp = new QGroupBox(tr("SMESH_BASE_POINT"), GroupArguments); BasePointGrp->setCheckable(true); @@ -337,7 +325,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); myElementsFilter = new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR); - myPathMeshFilter = new SMESH_TypeFilter (MESH); + //myPathMeshFilter = new SMESH_TypeFilter (MESH); + myPathMeshFilter = new SMESH_TypeFilter(MESHorSUBMESH); myHelpFileName = "extrusion_along_path_page.html"; @@ -357,7 +346,6 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectPathMeshButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(SelectPathShapeButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectStartPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectBasePointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); @@ -405,12 +393,10 @@ void SMESHGUI_ExtrusionAlongPathDlg::Init (bool ResetControls) myMesh = SMESH::SMESH_Mesh::_nil(); myIDSource = SMESH::SMESH_IDSource::_nil(); myMeshActor = 0; - myPathMesh = SMESH::SMESH_Mesh::_nil(); - myPathShape = GEOM::GEOM_Object::_nil(); + myPath = SMESH::SMESH_IDSource::_nil(); ElementsLineEdit->clear(); PathMeshLineEdit->clear(); - PathShapeLineEdit->clear(); StartPointLineEdit->clear(); if (ResetControls) { @@ -483,8 +469,10 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() if (mySMESHGUI->isActiveStudyLocked()) return false; - if (myMesh->_is_nil() || MeshCheck->isChecked() && myIDSource->_is_nil() || - !myMeshActor || myPathMesh->_is_nil() || myPathShape->_is_nil()) + //if (myMesh->_is_nil() || MeshCheck->isChecked() && myIDSource->_is_nil() || + // !myMeshActor || myPathMesh->_is_nil() || myPathShape->_is_nil()) + if ( myMesh->_is_nil() || MeshCheck->isChecked() && myIDSource->_is_nil() || + !myMeshActor || myPath->_is_nil() ) return false; if (!isValid()) @@ -563,10 +551,12 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() try { SUIT_OverrideCursor wc; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - if ( LinearAnglesCheck->isChecked() ) - anAngles = aMeshEditor->LinearAnglesVariation( myPathMesh, myPathShape, anAngles ); + //if ( LinearAnglesCheck->isChecked() ) { + // anAngles = aMeshEditor->LinearAnglesVariation( myPathMesh, myPathShape, anAngles ); + //} SMESH::SMESH_MeshEditor::Extrusion_Error retVal; + /* if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) { if( MeshCheck->isChecked() ) { if( GetConstructorId() == 0 ) @@ -608,6 +598,27 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() AnglesGrp->isChecked(), anAngles, BasePointGrp->isChecked(), aBasePoint); } + */ + + bool NeedGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ); + SMESH::ElementType ElemType = SMESH::FACE; + if( GetConstructorId() == 0 ) + ElemType = SMESH::EDGE; + if( !MeshCheck->isChecked() ) { + SMESH::ListOfGroups_var groups = + aMeshEditor->ExtrusionAlongPathX(anElementsId, myPath, aNodeStart, AnglesGrp->isChecked(), + anAngles, LinearAnglesCheck->isChecked(), + BasePointGrp->isChecked(), aBasePoint, + NeedGroups, ElemType, retVal); + } + else { + SMESH::ListOfGroups_var groups = + aMeshEditor->ExtrusionAlongPathObjX(myIDSource, myPath, aNodeStart, AnglesGrp->isChecked(), + anAngles, LinearAnglesCheck->isChecked(), + BasePointGrp->isChecked(), aBasePoint, + NeedGroups, ElemType, retVal); + } + if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK ) myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) ); @@ -767,10 +778,11 @@ void SMESHGUI_ExtrusionAlongPathDlg::onTextChange (const QString& theNewText) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->highlight( anIO, true, true ); } - } else if (send == StartPointLineEdit && + } + else if (send == StartPointLineEdit && myEditCurrentArgument == StartPointLineEdit) { - if (!myPathMesh->_is_nil()) { - SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh); + if (!myPath->_is_nil()) { + SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPath); SMDS_Mesh* aMesh = 0; if (aPathActor) aMesh = aPathActor->GetObject()->GetMesh(); @@ -862,57 +874,37 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument() SMESH::GetNameOfSelectedElements(mySelector, IO, aString); ElementsLineEdit->setText(aString); } - } else if (myEditCurrentArgument == PathMeshLineEdit) { + } + else if (myEditCurrentArgument == PathMeshLineEdit) { // we are now selecting path mesh // reset PathMeshLineEdit->clear(); - myPathMesh = SMESH::SMESH_Mesh::_nil(); - PathShapeLineEdit->clear(); - myPathShape = GEOM::GEOM_Object::_nil(); + myPath = SMESH::SMESH_IDSource::_nil(); StartPointLineEdit->clear(); - + // try to get mesh from selection Handle(SALOME_InteractiveObject) IO = aList.First(); - myPathMesh = SMESH::IObjectToInterface(IO); - if(myPathMesh->_is_nil()) + myPath = SMESH::IObjectToInterface(IO); + if( myPath->_is_nil() ) return; - + QString aString; SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString); PathMeshLineEdit->setText(aString); - } else if (myEditCurrentArgument == PathShapeLineEdit) { - // we are now selecting path mesh - // reset - PathShapeLineEdit->clear(); - myPathShape = GEOM::GEOM_Object::_nil(); - StartPointLineEdit->clear(); - - // return if path mesh is not yet selected - if (myPathMesh->_is_nil()) - return; - - // try to get shape from selection - Handle(SALOME_InteractiveObject) IO = aList.First(); - myPathShape = SMESH::IObjectToInterface(IO); - if (myPathShape->_is_nil()) - return; - - QString aString; - SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString); - PathShapeLineEdit->setText(aString); - } else if (myEditCurrentArgument == StartPointLineEdit) { + } + else if (myEditCurrentArgument == StartPointLineEdit) { // we are now selecting start point of path // reset StartPointLineEdit->clear(); // return if path mesh or path shape is not yet selected - if (myPathMesh->_is_nil() || myPathShape->_is_nil()) + if( myPath->_is_nil() ) return; // try to get shape from selection Handle(SALOME_InteractiveObject) IO = aList.First(); - SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh); + SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPath); if ( !aPathActor ) return; @@ -983,7 +975,6 @@ void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument() QToolButton* send = (QToolButton*)sender(); if (send != SelectElementsButton && send != SelectPathMeshButton && - send != SelectPathShapeButton && send != SelectStartPointButton && send != SelectBasePointButton) return; @@ -1027,26 +1018,11 @@ void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button aViewWindow->SetSelectionMode(ActorSelection); mySelectionMgr->installFilter(myPathMeshFilter); } - else if (button == SelectPathShapeButton) { - myEditCurrentArgument = PathShapeLineEdit; - SMESH::SetPointRepresentation(false); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); - - if (!myPathMesh->_is_nil()) { - GEOM::GEOM_Object_var aMainShape = myPathMesh->GetShapeToMesh(); - SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh); - - if (!aMainShape->_is_nil() && aPathActor) - mySelectionMgr->installFilter(new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, -1, - TopAbs_EDGE, aMainShape)); - //SMESH::SetPickable(aPathActor); - } - } else if (button == SelectStartPointButton) { myEditCurrentArgument = StartPointLineEdit; - if (!myPathMesh->_is_nil()) { - SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh); + //if (!myPathMesh->_is_nil()) { + if (!myPath->_is_nil()) { + SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPath); if (aPathActor) { SMESH::SetPointRepresentation(true); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h index 5d70d6306..e93985ae1 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h @@ -94,8 +94,9 @@ private: SMESH::SMESH_Mesh_var myMesh; SMESH_Actor* myMeshActor; SMESH::SMESH_IDSource_var myIDSource; - SMESH::SMESH_Mesh_var myPathMesh; - GEOM::GEOM_Object_var myPathShape; + //SMESH::SMESH_Mesh_var myPathMesh; + SMESH::SMESH_IDSource_var myPath; + //GEOM::GEOM_Object_var myPathShape; SUIT_SelectionFilter* myElementsFilter; SUIT_SelectionFilter* myPathMeshFilter; int myType; @@ -115,8 +116,8 @@ private: QGroupBox* PathGrp; QToolButton* SelectPathMeshButton; QLineEdit* PathMeshLineEdit; - QToolButton* SelectPathShapeButton; - QLineEdit* PathShapeLineEdit; + //QToolButton* SelectPathShapeButton; + //QLineEdit* PathShapeLineEdit; QToolButton* SelectStartPointButton; QLineEdit* StartPointLineEdit; QCheckBox* LinearAnglesCheck; diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 3668a6aac..27f0d1453 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -3497,7 +3497,7 @@ Please select a groups and try again SMESH_PATH_MESH - Mesh + Mesh or submesh SMESH_PATH_SHAPE diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index a68bd8fb2..0463ee5d2 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -34,6 +34,8 @@ #include "SMESH_subMeshEventListener.hxx" #include "SMESH_Gen_i.hxx" #include "SMESH_Filter_i.hxx" +#include "SMESH_subMesh_i.hxx" +#include "SMESH_Group_i.hxx" #include "SMESH_PythonDump.hxx" #include "utilities.h" @@ -1996,7 +1998,7 @@ SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array & theIDsOfEleme ::SMESH_MeshEditor anEditor( myMesh ); ::SMESH_MeshEditor::Extrusion_Error error = anEditor.ExtrusionAlongTrack( elements, aSubMesh, nodeStart, - theHasAngles, angles, + theHasAngles, angles, false, theHasRefPoint, refPnt, theMakeGroups ); storeResult(anEditor); theError = convExtrError( error ); @@ -2011,6 +2013,105 @@ SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array & theIDsOfEleme return 0; } + +//======================================================================= +//function : extrusionAlongPathX +//purpose : +//======================================================================= + +SMESH::ListOfGroups* +SMESH_MeshEditor_i::extrusionAlongPathX(const SMESH::long_array & IDsOfElements, + SMESH::SMESH_IDSource_ptr Path, + CORBA::Long NodeStart, + CORBA::Boolean HasAngles, + const SMESH::double_array& Angles, + CORBA::Boolean LinearVariation, + CORBA::Boolean HasRefPoint, + const SMESH::PointStruct& RefPoint, + const bool MakeGroups, + const SMDSAbs_ElementType ElementType, + SMESH::SMESH_MeshEditor::Extrusion_Error & Error) +{ + SMESH::ListOfGroups* EmptyGr = new SMESH::ListOfGroups; + + initData(); + + list angles; + for (int i = 0; i < Angles.length(); i++) { + angles.push_back( Angles[i] ); + } + gp_Pnt refPnt( RefPoint.x, RefPoint.y, RefPoint.z ); + int nbOldGroups = myMesh->NbGroup(); + + if ( Path->_is_nil() ) { + Error = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE; + return EmptyGr; + } + + TIDSortedElemSet elements; + arrayToSet(IDsOfElements, GetMeshDS(), elements, ElementType); + + ::SMESH_MeshEditor anEditor( myMesh ); + ::SMESH_MeshEditor::Extrusion_Error error; + + SMESH_Mesh_i* aMeshImp = SMESH::DownCast( Path ); + if(aMeshImp) { + // path as mesh + SMDS_MeshNode* aNodeStart = + (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(NodeStart); + if ( !aNodeStart ) { + Error = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE; + return EmptyGr; + } + error = anEditor.ExtrusionAlongTrack( elements, &(aMeshImp->GetImpl()), aNodeStart, + HasAngles, angles, LinearVariation, + HasRefPoint, refPnt, MakeGroups ); + } + else { + SMESH_subMesh_i* aSubMeshImp = SMESH::DownCast( Path ); + if(aSubMeshImp) { + // path as submesh + SMESH::SMESH_Mesh_ptr aPathMesh = aSubMeshImp->GetFather(); + aMeshImp = SMESH::DownCast( aPathMesh ); + SMDS_MeshNode* aNodeStart = + (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(NodeStart); + if ( !aNodeStart ) { + Error = SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE; + return EmptyGr; + } + SMESH_subMesh* aSubMesh = + aMeshImp->GetImpl().GetSubMeshContaining(aSubMeshImp->GetId()); + error = anEditor.ExtrusionAlongTrack( elements, aSubMesh, aNodeStart, + HasAngles, angles, LinearVariation, + HasRefPoint, refPnt, MakeGroups ); + } + else { + SMESH_Group_i* aGroupImp = SMESH::DownCast( Path ); + if(aGroupImp) { + // path as group of 1D elements + } + else { + // invalid path + Error = SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE; + return EmptyGr; + } + } + } + + storeResult(anEditor); + Error = convExtrError( error ); + + if ( MakeGroups ) { + list groupIDs = myMesh->GetGroupIds(); + list::iterator newBegin = groupIDs.begin(); + std::advance( newBegin, nbOldGroups ); // skip old groups + groupIDs.erase( groupIDs.begin(), newBegin ); + return getGroups( & groupIDs ); + } + return EmptyGr; +} + + //======================================================================= //function : ExtrusionAlongPath //purpose : @@ -2409,6 +2510,124 @@ ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject, return aGroups; } + +//======================================================================= +//function : ExtrusionAlongPathObjX +//purpose : +//======================================================================= +SMESH::ListOfGroups* SMESH_MeshEditor_i:: +ExtrusionAlongPathObjX(SMESH::SMESH_IDSource_ptr Object, + SMESH::SMESH_IDSource_ptr Path, + CORBA::Long NodeStart, + CORBA::Boolean HasAngles, + const SMESH::double_array& Angles, + CORBA::Boolean LinearVariation, + CORBA::Boolean HasRefPoint, + const SMESH::PointStruct& RefPoint, + CORBA::Boolean MakeGroups, + SMESH::ElementType ElemType, + SMESH::SMESH_MeshEditor::Extrusion_Error& Error) +{ + SMESH::long_array_var anElementsId = Object->GetIDs(); + SMESH::ListOfGroups * aGroups = extrusionAlongPathX(anElementsId, + Path, + NodeStart, + HasAngles, + Angles, + LinearVariation, + HasRefPoint, + RefPoint, + MakeGroups, + (SMDSAbs_ElementType)ElemType, + Error); + + if ( !myPreviewMode ) { + bool isDumpGroups = aGroups && aGroups->length() > 0; + TPythonDump aPythonDump; + if(isDumpGroups) { + aPythonDump << "("<length() > 0; + TPythonDump aPythonDump; + if(isDumpGroups) { + aPythonDump << "("<