Approximate an open 2D SketchSpline with a chain of tangent arcs

I’d like to create a macro like this so that pragmatic users can quickly trace spline sketches from creative people using tangent arcs.

Perhaps there’s already a ready-made solution for this in SolidWorks?

For myself, I have formulated the task as follows:
Approximate an open 2D SketchSpline with a chain of tangent arcs using recursive biarc subdivision by maximum deviation tolerance.

Constraints needed:
Tolerance = 0.05 mm
MaxRecursionDepth = 20
MaxArcCount = 10000
MinArcLength = 0.001 mm

If a spline segment contains an inflection point, a single biarc may approximate it poorly. But recursive division will solve this.

If the original spline has self-intersections, this is a problem.

ArtCAM tool equivalent:
Spline / vector → Fit Arcs by tolerance

I started figuring out how to construct geometry programmatically, and I don’t think I’m even close to understanding what I’m getting myself into. I drew two arcs with a common point, but they display as line segments and aren’t selectable. And when I drag the common point, they wiggle considerably. Exiting the sketch and rebuilding it (copying the sketch, etc.) don’t help.


Sketch6 if anyone is interested.
TestPrt.SLDPRT (79.8 KB)