I'm having challenges with some IGES/STEP models where my code is not able to classify faces bases on the underlying classification of edges i.e whether an edge is a Straight line(non-rational Bspline curve) or arc(rational Bspline curve). I have been using the code below (which works for some models):
edgex.setIsRational(BRepAdaptor_Curve(edge).IsRational());
,where the edge is a TopoDS_Edge and edgex is a custom Edge object. I also tried the following code but it crashes the program on the second line:
BRepAdaptor_Curve curve = BRepAdaptor_Curve(edge);
Handle_Geom_BSplineCurve spline = curve.BSpline();
edgex.setIsRational(spline.IsRational())
May you please help with a better method or fix for my solutions. Thank you in advance.
You can use the BrepAdaptor::GetType()
method to determine the type of curve. The crash in the second line occurs, apparently, that the edge is not a BSpline curve, and the BrepAdaptor::BSpline()
method creates a copy, and there is nothing to make it from.