
Wed, 01/17/2001 - 02:34
I want to find common point between two curves. This is my (poor) code:
Handle_Geom_Curve Curve=Surface->UIso(CurU); TopoDS_Edge anEdgeDS = BRepBuilderAPI_MakeEdge(Curve);
Handle(AIS_Shape) Edge = new AIS_Shape(anEdgeDS);
m_pAISContext->Display(Edge);
while(exp.More())
{
TopoDS_Edge m_Edge=TopoDS::Edge(exp.Current());
Handle_Geom_Curve Curve2=BRep_Tool::Curve(m_Edge,First,Last);
try
{
ECC.Init(Curve,Curve2);
ECC.NearestPoints(P1,P2);
if((P1.X()==P2.X())&&(P1.Y()==P2.Y())&&(P1.Z()==P2.Z()))
{
TopoDS_Vertex dsV=BRepBuilderAPI_MakeVertex(P1);
Handle(AIS_Shape) aisVt = new AIS_Shape(dsV);
m_pAISContext->Display(aisVt);
}
}
catch(StdFail_NotDone)
{
AfxMessageBox("Fails");
break;
}
exp.Next();
}
But I encounted exception at ECC.NearestPoints(P1,P2)... I did try to catch exception... but I didn't catch exception... What's wrong my code... please help me...
Wed, 01/17/2001 - 21:40
You might try to catch the exception at a lower level (like Standard_Failure) and see the message thrown by the exception, or at least the kind of exception. Try like this:
try { // code... } catch (Standard_Failure) { cout<< "Message: "; Handle(Standard_Failure) E = Standard_Failure::Caught(); E->Print(cout); cout << endl; }
Because even if the ECC.NearestPoints(P1,P2); code should throw only a exception of type StdFail_NotDone, the exception might come from somewhere else...
Good Luck. Francois.