use helper.GetCommonAncestor()

This commit is contained in:
eap 2011-10-13 05:34:25 +00:00
parent 5036f6282e
commit 9091ead47e
2 changed files with 6 additions and 18 deletions

View File

@ -429,14 +429,9 @@ bool StdMeshers_Import_1D2D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape &
if ( bndShapes.back().ShapeType() != TopAbs_EDGE ) if ( bndShapes.back().ShapeType() != TopAbs_EDGE )
{ {
// find geom edge by two vertices // find geom edge by two vertices
TopoDS_Shape geomEdge; TopoDS_Shape geomEdge = helper.GetCommonAncestor( bndShapes.back(),
PShapeIteratorPtr edgeIt = helper.GetAncestors( bndShapes.back(), theMesh, TopAbs_EDGE ); bndShapes.front(),
while ( edgeIt->more() ) theMesh, TopAbs_EDGE );
{
geomEdge = *(edgeIt->next());
if ( !helper.IsSubShape( bndShapes.front(), geomEdge ))
geomEdge.Nullify();
}
if ( geomEdge.IsNull() ) if ( geomEdge.IsNull() )
break; // vertices belong to different edges -> error: free internal link break; // vertices belong to different edges -> error: free internal link
bndShapes.push_back( geomEdge ); bndShapes.push_back( geomEdge );

View File

@ -2201,16 +2201,9 @@ TopoDS_Edge StdMeshers_PrismAsBlock::TSideFace::GetEdge(const int iEdge) const
TopoDS_Shape V2 = myHelper->GetSubShapeByNode( node, meshDS ); TopoDS_Shape V2 = myHelper->GetSubShapeByNode( node, meshDS );
if ( V2.ShapeType() == TopAbs_VERTEX && !V2.IsSame( V1 )) if ( V2.ShapeType() == TopAbs_VERTEX && !V2.IsSame( V1 ))
{ {
TopTools_ListIteratorOfListOfShape ancestIt = TopoDS_Shape ancestor = myHelper->GetCommonAncestor( V1, V2, *myHelper->GetMesh(), TopAbs_EDGE);
myHelper->GetMesh()->GetAncestors( V1 ); if ( !ancestor.IsNull() )
for ( ; ancestIt.More(); ancestIt.Next() ) return TopoDS::Edge( ancestor );
{
const TopoDS_Shape & ancestor = ancestIt.Value();
if ( ancestor.ShapeType() == TopAbs_EDGE )
for ( TopExp_Explorer e( ancestor, TopAbs_VERTEX ); e.More(); e.Next() )
if ( V2.IsSame( e.Current() ))
return TopoDS::Edge( ancestor );
}
} }
return TopoDS_Edge(); return TopoDS_Edge();
} }