OpenJSCAD.org icon indicating copy to clipboard operation
OpenJSCAD.org copied to clipboard

DXF : Add support for SPLINE entities

Open z3dev opened this issue 6 years ago • 2 comments

This is another muli-section 'line' based entity found in later versions of DXF. As such, these can be converted to paths.

z3dev avatar Aug 22 '19 08:08 z3dev

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.

z3dev avatar Aug 27 '19 22:08 z3dev

Another library that does conversions....

https://sourceforge.net/projects/dxf2gcode/

z3dev avatar Nov 05 '20 14:11 z3dev