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

Comments

  1. Thank you! Great job! God bless!

    ReplyDelete
  2. 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?

    ReplyDelete
  3. 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.

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

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

    ReplyDelete
  6. Thanks for sharing this valuable post. Perfect shell script!

    ReplyDelete
  7. there is a wrong path to Inkscape on MacOS in the script, plus it did not worked for me.. this one does and rocks!
    https://gist.github.com/ppelleti/eba27c66b3a20d89ca4e1e30c05e81c1

    (those who have no pstoedit run: brew install pstoedit)

    ReplyDelete
  8. Why not using a tool like svgtodxf.com ?

    ReplyDelete

Post a Comment

Popular posts from this blog

Decommissioning the cloud: A self-hosted future

Using a JFileChooser to browse AWS S3

Taking Stuff Apart: Realistic Modulette-8