1

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?

0

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.

|improve this answer|||||
  • 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
  • I could not find such script ps2pdf.sh, as this bash command returned no results: find / -name ps2pdf.sh 2>/dev/null. I do have ps2pdf installed and the man page shows it's only for PDF: ps2pdf - Convert PostScript to PDF using ghostscript. So I won't pursue this solution. – miguelmorin Sep 8 '18 at 14:39

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.