I must decode STEP cad file in which a 3d circle can be defined as a spline. I want being able to decode that the spline is an arc or a circle.
At first I have the step B_SPLINE_CURVE_WITH_KNOTS element.
#307 = B_SPLINE_CURVE_WITH_KNOTS ( 'NONE', 3,( #114, #212, #179, #317, #91, #191, #141, #97, #150, #63, #121, #243, #75, #43, #15, #164, #315, #284, #302, #70, #269, #251, #151, #220, #178, #172, #248, #185, #156, #249, #300, #47, #124, #335, #360, #59, #357, #343, #12, #5, #112, #324, #344, #193, #329, #320, #313, #222, #51, #167, #286, #268, #310, #32, #267, #52, #66, #69 ),.UNSPECIFIED., .T., .F., ( 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4 ), ( 0.0000000000000000000, 0.0003907630664662950000, 0.0007815261329325900100, 0.001172289199398885000, 0.001563052265865180000, 0.002344578398797811600, 0.003126104531730443300, 0.003516867598196761600, 0.003907630664663080300, 0.004298393731129399400, 0.004689156797595717700, 0.005079919864062035900, 0.005470682930528354200, 0.005861445996994673300, 0.006252209063460992400, 0.006642972129927311600, 0.007033735196393629000, 0.007815261329326231600, 0.008206024395792531700, 0.008596787462258833500, 0.008987550528725133500, 0.009378313595191433600, 0.009769076661657735300, 0.01015983972812403500, 0.01055060279459033500, 0.01094136586105663500, 0.01133212892752293700, 0.01172289199398923700, 0.01250441812692185600 ), .UNSPECIFIED. ) ;
So if I am right, I decoded :
58 control points
29 knot_multiciplities
29 knots
degree 3
closed_curve argument = True
now, the idea would be to convert it to beziers curve in order to find arc/circles, but I am stuck in front of these parameters.
You can work out the arc through 3 consecutive knots. If the arc is constant for all the triples of your bspline, the curve is an arc itself.