Inkscape OpenSCAD DXF Export
by polymaker, published
The current steps you need to take to turn an SVG into an OpenSCAD usable DXF are the following:
1. Convert all objects to paths
2. Add extra points to paths
3. Convert paths to lines
4. Export to DXF
After all that you may use your SVG design in OpenSCAD, but then if you want to edit your design you are faced with two equally unpalatable options: edit the original design and go through the steps again, or edit the DXF directly.
I had had enough and set out to automate that process. I took all the best parts of at least 3 other DXF output extensions (I lost count!) and added automation for the steps listed above. With this Inkscape extension, you can edit/save your design and simply "Save a Copy As" to DXF whenever you want to try it in OpenSCAD. It is a lot smoother that way.
Supposedly it exports color to the dxf as well but I don't know if that's supported in openscad.
NOTE: If you change the size of the document in Inkscape the exported DXF will have misplaced objects. A workaround for this is to recreate all layers after resizing the document. I know, painful, but once you have the size worked out it's not bad.
The extension automatically adds dimensions to the DXF: layer_name_width and layer_name_height for each layer and total_width and total_height.
The dimensions can be accessed using the built-in dxf_dim command. Ex.:
total_width = dxf_dim(file = "openscaddxf.dxf", name = "total_width");
Three fairly small provisos:
- It's fairly slow because it has to launch a new inkscape instance to convert the objects to paths. It's not a pretty solution, but I believe it's the only way to do it at the moment.
- Doesn't work with groups. You will need to ungroup everything before exporting
- Doesn't work with intersecting lines. This will cause either the offending objects to disappear or everything will appear outlined instead of filled in.
Repo is here: github.com/brad/Inkscape-OpenSCAD-DXF-Export
Recent Commentsview all
I am receiving errors when i try to save. I have uninstalled Inkscape, started fresh with a new download and placed the files in the shared folder.
Traceback (most recent call last):
File "openscad_dxf.py", line 231, in <module>
if __name__ == '__main__': OpenSCADDXFEffect().affect()
File "C:\Program Files\Inkscape\share\extensions\inkex.py", line 215, in affect
File "openscad_dxf.py", line 199, in effect
File "openscad_dxf.py", line 126, in dxf_add_dimension
('13', '%f' % (x if x is not None else 0.0)),
TypeError: float argument required, not NoneType</module>
Liked Byview all
Give a Shout Out
Create some objects in Inkscape and save them directly to a DXF that OpenSCAD can use! The included STL is an extruded DXF generated from pure Inkscape objects.
You must be logged in to post a comment.