Tue, 01/18/2005 - 12:01
Forums:
Hi All,
I made a bspline curve by approximating a TopoDS_Wire with Approx_Curve3d and then made the display.
I selected this edge with mouse. But when I want to make a Handle(Geom_Curve)with BRep_Tool, an unexpected error took place.
Thanks for any idea.
Akbari
------------------------------------------------------
TopoDS_Edge F;
F=TopoDS::Edge(myAISContext->SelectedShape());
myAISContext->CloseAllContexts();
BRep_Tool aaa;
Standard_Real a,b;
TopLoc_Location L;
Handle(Geom_Curve) Curve1=aaa.Curve(F,L,a,b); //this line will make unexpected error.
Tue, 01/18/2005 - 15:17
Maybe the selected shape is not an edge (a compound for example), does F.IsNull() return true?
Good Luck,
Francois.
Wed, 01/19/2005 - 09:51
Hi Francois,
Thank you for your answer.
I checked it and it returned false. But what is the wrong and what should I do?
Regards
Akbari
Wed, 01/19/2005 - 15:49
It means the shape in your AIS_Shape is not an edge directly, it's something else (maybe a compound, a wire,...). You might want to check what type of shape it is (sometime, when an algorythm don't succeed in building something, it returns a incomplete result in a compound instead of what you might be expecting):
std::cout << myAISContext->SelectedShape().TShape()->DynamicType()->Name()<SelectedShape(),TopAbs_EDGE); Ex.More(); Ex.Next()) {
// now it's an edge
TopoDS_Edge anEdge=TopoDS::Edge(Ex.Current());
BRep_Tool aaa;
Standard_Real a,b;
TopLoc_Location L;
Handle(Geom_Curve) Curve1=aaa.Curve(F,L,a,b);
}
Just make sur you have only one edge in your shape, for some reason you might have more than one.
Good Luck,
Francois.
Wed, 01/19/2005 - 16:23
Thank you Francois,
But this curve will not be usefull for me. is there any way to make an approximation to have a geom_curve from topods_wire like digitizing wire to a lot of points and do an approximation?
regards
Susan
Wed, 01/19/2005 - 16:35
Hi Susan,
how did you build the shape you pass to your AIS_Shape object? I've just look at the documentation of Approx_Curve3d and it should return a Geom_BSplineCurve, if you build an TopoDS_Edge and pass it to the AIS_Shape, you should get a TopoDS_Edge in return...