DXF12 output uses POLYLINEs instead of a series of LINEs
What does the merge request do?
Changes the DXF12 output to use POLYLINEs instead of a series of LINEs; this allows us to have grouped line segments and (importantly) closed groups of lines.
I validated the changes on the test output DXFs by running the new (and original) ones through ezdxf draw -o ${file}.svg ${file}.dxf, and found that there are no substantial differences, other than the output of text looking better.
Implementation notes
I added a break_apart() call to generate subpaths because while SVG’s <path> element allows for paths with Zs in the middle, DXF’s POLYLINEs only close at the end, meaning that any medial Zs would simply be ignored. (The story to how I figured that one out involves a garbled mess getting lasered into a piece of acrylic, but that’s on me :))
Things I considered but then didn’t do
I was considering adding SPLINE support as well, but read a reddit post about SPLINEs getting flattened into a bunch of POLYLINEs anyways (source), so I didn’t think it was worth it.
In a previous draft, I also added support for DXF12 CIRCLEs that inkex.Transform.apply_to_point to apply the node’s composed transform to the center vector, but when trying to figure out how to apply the same transform to the radius, I realized that this work would be easily undercut by something like a skewX transform (after which this is no longer a circle at all), so I opted instead to leave the circle represented as a POLYLINE.
Summary for release notes
DXF12 output now supports closed paths.
Checklist
-
Add unit tests (if applicable) -
Changes toinkex/are well documented -
Clean merge request history