Easy and accurate SVG to DXF conversion using Inkscape and pstoedit

If you've ever worked with a vector tool to design something to be carved with a CNC routing machine, you may have needed to convert the resulting SVG file into a DXF. In my workflow I often use Inkscape to generate my SVG graphic, but my CAD software is CamBam and it requires a DXF file.

Many people have tried to make the perfect Inkscape plugin for exporting DXF, there is Better DXF ExportBetter Better DXF Export and Big Blue Saw's DXF Export. I've had the most luck with the last one, but it was still finicky and often broke when updating Inkscape or OSX. Not only that, but at the end of the Big Blue Saw page, Simon mentions that he doesn't even use the plugin most of the time, instead relying on a command line tool called pstoedit.

With that in mind I made a small shell script which will convert an SVG file to DXF, you can save the script and run it directly or add the functions to your startup script.

The script is available on github under the project svgToDxf. If you choose to add the functions directly to your startup script, as I have, simply copy the functions here and paste them in your .bashrc file. Now all you need to do to convert an SVG file to DXF is use the command svgToDxf MyCoolDesign.svg and the output will be MyCoolDesign.dxf

7 comments:

Anonymous said...

Thank you! Great job! God bless!

Unknown said...

I'm running windows 10, 64 bit, Inkscape 0.91 64 bit but cabt fine the startup script nor the file that you mention (.bashrc) to paste your script into... (No, I don't know what I'm doing, just trying to follow directions lol...) Ive used search option in file explorer but no luck... help?

Will Winder said...

Sorry, but this is a unix shell script using command line tools. Supposedly Windows 10 supports bash now, so you might be able to get it working. But you'd probably need to know what you're doing to get everything setup and working.

geodans said...

oops, sorry still stuck on the dark side, Didn't realize that it was not win...

Forrest Koran said...

This is perfect, thanks!

Andrew D. Covey said...

Many good things be upon you; this little script is very handy and it works perfectly for my needs. Thanks so much for sharing!

Josh @ Techni Waterjet said...

Thanks for sharing this valuable post. Perfect shell script!

Post a Comment