I need to save an Inkscape file as DXF for a laser cutter and a CNC router. The Inkscape manual mentions I can save a file as DXF, which I do through the GUI and it works: File > Save As > Desktop Plotting Cutter (AutoCAD DXF R14) (*.dxf). The manual also gives the example of manipulating and saving an SVG file through the command-line:

inkscape filename.svg --select=path1555 --verb=EditDuplicate --verb=ObjectRotate90 --verb=FileSave --verb=FileClose

The list of verbs in the Inkscape command-line tools has only two references to DXF inside gcode options, and none to DXF:

> inkscape --verb-list | grep -i "dxf\|autocad"
ru.cnc-club.filter.gcodetools_dxfpoints_no_options: DXF Points...
ru.cnc-club.filter.gcodetools_dxfpoints_no_options.noprefs: DXF Points (No preferences)

How can I save a file as DXF programmatically?

  • Really unclear how this is a "graphic design" question. – Scott May 1 '20 at 0:18
  • @Scott I use Inkscape for graphic design and the CNC router for manufacturing. Shall I move the question to another forum, maybe engineering? – miguelmorin May 2 '20 at 17:54
  • 1
    I think it's far more an engineering question than a design question. Graphic designers rarely use DXF format and I've yet to hear of one using CNC machines. But that's all merely my opinion. I am by no means the definitive authority. – Scott May 2 '20 at 19:15

It seems that 'output' type extensions are not available as verbs in the verb list, in contrary to 'effect' type extensions. I couldn't find any of the others, either.

There's a shell script for DXF 12 included with Inkscape (/usr/share/extensions/ps2dxf.sh). It can convert postscript files programmatically to dxf - using pstoedit. Maybe that's an option for you.

  • I am interested in DXF or gcode. Can you confirm the ps2pdf.sh option? And would I have to save the SVG as PS by some other means? – miguelmorin Jun 24 '18 at 19:40
  • Yes, it would require to export to ps (Inkscape can do that programmatically). Not sure what you mean by 'confirm the option'? – Moini Jun 27 '18 at 12:44
  • I meant that I wanted to convert SVG to DXF and your answer seemed to be for PS to PDF, so I wanted to confirm that PS to PDF would also work for SVG to DXF. – miguelmorin Jun 27 '18 at 14:47
  • I didn't try, but it should work to programmatically export from SVG to PS, and then use the script (or the commands it contains) to do the next conversion to dxf. – Moini Jun 28 '18 at 11:43
  • 1
    That script is in /usr/share/inkscape/extensions. It's called ps2dxf.sh, I'm very sorry about the typo. – Moini Sep 8 '18 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.