OpenJSCAD.org
OpenJSCAD.org copied to clipboard
DXF : Add support for SPLINE entities
This is another muli-section 'line' based entity found in later versions of DXF. As such, these can be converted to paths.
From DXF Parser...
Where possible SPLINE entities are rendered using native SVG quadratic and cubic beziers.
Good memo on spline knots can be found here: https://saccade.com/writing/graphics/KnotVectors.pdf
Not all splines are supported - the start and end must be "pinned" (the same knot must be repeated k times at the start and end of the knot vector where k = the order of the spline).
The process is:
- Check that the spline is pinned
- Convert the spline into a piecewize bezier. This is done by inserting knots so that all knots have a multiplicity of k-1.
- If knots have the correct multiplicity then the spline control points are the bezier control points, and these are used in the SVG element.
- If the algorithm fails at any point it reverts to rendering using interpolation.
Another library that does conversions....
https://sourceforge.net/projects/dxf2gcode/