Change tolerance for detecting geometry types.

Hello!

Is there a way to change the tolerance to detect Circles? I'm using 'GeomAbs_CurveType curveType = aAdaptedCurve.GetType()' to see if an edge is a straight line, circle, and so on. But some of my circles are not detected and marked as BSplineCurve. when using IGES files, my code fails to detect some of the circles and mark them as b-splines. For STEP files, there seems to be no problem

I have a plate with several hundreds of holes and I would like to detect them all

thanks!

Stephane Routelous's picture

AFAIK, BRepAdaptor_Curve / GeomAdaptor_Curve return the real type of the curve, not its shape.
So there is no way to set a tolerance for checking if a BSplineCurve is a circle.
In your case, the software you use for outputing your IGES/STEP files is writting bspines instead of circles, or the OCCT importer convert the circles to bsplines.

To check if a curve is approx a circle, you can take 3 random points of the curve ( with aAdaptedCurve.Value(param), create a circle from the 3 points ( GC_MakeCircle ), then take some sample points on the edge, and check for each sample point if the abs(distance(SamplePoint,CircleCenter) - CircleRadius ) > tolerance.

HTH,

Stephane

Cesar A. Rivas's picture

Thank you for your reply!

I used something similar to your suggestion. I use the initial, the middle and the end points. It was easier than I original think. :)

once and again , thank you!

Stephane Routelous's picture

if you have a full circle as bspline, first point = last point, so the circle creation will fail