0021993: EDF SMESH : Crash during extrusion of a mesh along a path

This commit is contained in:
vsr 2012-11-22 12:47:57 +00:00
parent aca17796fd
commit 524a42c02b

View File

@ -5173,10 +5173,16 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
if ( BRep_Tool::Degenerated( aTrackEdge ) ) if ( BRep_Tool::Degenerated( aTrackEdge ) )
return EXTR_BAD_PATH_SHAPE; return EXTR_BAD_PATH_SHAPE;
TopExp::Vertices( aTrackEdge, aV1, aV2 ); TopExp::Vertices( aTrackEdge, aV1, aV2 );
const SMDS_MeshNode* aN1 = 0;
const SMDS_MeshNode* aN2 = 0;
if ( theTrack->GetSubMesh( aV1 ) && theTrack->GetSubMesh( aV1 )->GetSubMeshDS() ) {
aItN = theTrack->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes(); aItN = theTrack->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes();
const SMDS_MeshNode* aN1 = aItN->next(); aN1 = aItN->next();
}
if ( theTrack->GetSubMesh( aV2 ) && theTrack->GetSubMesh( aV2 )->GetSubMeshDS() ) {
aItN = theTrack->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes(); aItN = theTrack->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes();
const SMDS_MeshNode* aN2 = aItN->next(); aN2 = aItN->next();
}
// starting node must be aN1 or aN2 // starting node must be aN1 or aN2
if ( !( aN1 == theN1 || aN2 == theN1 ) ) if ( !( aN1 == theN1 || aN2 == theN1 ) )
return EXTR_BAD_STARTING_NODE; return EXTR_BAD_STARTING_NODE;
@ -5206,7 +5212,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
} }
} }
list< list<SMESH_MeshEditor_PathPoint> > LLPPs; list< list<SMESH_MeshEditor_PathPoint> > LLPPs;
int startNid = theN1->GetID(); TopoDS_Vertex aVprev;
TColStd_MapOfInteger UsedNums; TColStd_MapOfInteger UsedNums;
int NbEdges = Edges.Length(); int NbEdges = Edges.Length();
int i = 1; int i = 1;
@ -5220,12 +5226,32 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
SMESH_subMesh* locTrack = *itLSM; SMESH_subMesh* locTrack = *itLSM;
SMESHDS_SubMesh* locMeshDS = locTrack->GetSubMeshDS(); SMESHDS_SubMesh* locMeshDS = locTrack->GetSubMeshDS();
TopExp::Vertices( aTrackEdge, aV1, aV2 ); TopExp::Vertices( aTrackEdge, aV1, aV2 );
bool aN1isOK = false, aN2isOK = false;
if ( aVprev.IsNull() ) {
// if previous vertex is not yet defined, it means that we in the beginning of wire
// and we have to find initial vertex corresponding to starting node theN1
const SMDS_MeshNode* aN1 = 0;
const SMDS_MeshNode* aN2 = 0;
if ( locTrack->GetFather()->GetSubMesh(aV1) && locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS() ) {
aItN = locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS()->GetNodes(); aItN = locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS()->GetNodes();
const SMDS_MeshNode* aN1 = aItN->next(); aN1 = aItN->next();
}
if ( locTrack->GetFather()->GetSubMesh(aV2) && locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS() ) {
aItN = locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS()->GetNodes(); aItN = locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS()->GetNodes();
const SMDS_MeshNode* aN2 = aItN->next(); aN2 = aItN->next();
}
// starting node must be aN1 or aN2 // starting node must be aN1 or aN2
if ( !( aN1->GetID() == startNid || aN2->GetID() == startNid ) ) continue; aN1isOK = aN1 && aN1->GetID() == theN1->GetID();
aN2isOK = aN2 && aN2->GetID() == theN1->GetID();
}
else {
// we have specified ending vertex of the previous edge on the previous iteration
// and we have just to check that it corresponds to any vertex in current segment
aN1isOK = aVprev.IsSame( aV1 );
aN2isOK = aVprev.IsSame( aV2 );
}
if ( !aN1isOK && !aN2isOK ) continue;
// 2. Collect parameters on the track edge // 2. Collect parameters on the track edge
aPrms.clear(); aPrms.clear();
aItN = locMeshDS->GetNodes(); aItN = locMeshDS->GetNodes();
@ -5238,12 +5264,12 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
} }
list<SMESH_MeshEditor_PathPoint> LPP; list<SMESH_MeshEditor_PathPoint> LPP;
//Extrusion_Error err = //Extrusion_Error err =
MakeEdgePathPoints(aPrms, aTrackEdge,(aN1->GetID()==startNid), LPP); MakeEdgePathPoints(aPrms, aTrackEdge, aN1isOK, LPP);
LLPPs.push_back(LPP); LLPPs.push_back(LPP);
UsedNums.Add(k); UsedNums.Add(k);
// update startN for search following egde // update startN for search following egde
if( aN1->GetID() == startNid ) startNid = aN2->GetID(); if ( aN1isOK ) aVprev = aV2;
else startNid = aN1->GetID(); else aVprev = aV1;
break; break;
} }
} }