export to dxf via command line

Bug #503784 reported by Wolfenden
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Inkscape
Invalid
Wishlist
Unassigned

Bug Description

This is not a bug but this is where the website keeps sending me when I click request a feature.
Inkscape seems to be the best programme for converting svg to dxf, but I need to automate this for a whole folder. As a result I really need an export to dxf purely by command line. Is it there and I'm missing it? Or is it easily created?
Best
Robin

su_v (suv-lp)
tags: added: cli extensions-plugins
su_v (suv-lp)
Changed in inkscape:
importance: Undecided → Wishlist
tags: added: exporting
helix84 (helix84)
summary: - Not a bug, I need to export to dxf via command line
+ export to dxf via command line
Revision history for this message
helix84 (helix84) wrote :

There is indeed no command line option to export to .dxf (i would think that's because it's implemented as an extension) but it should be easy enough to do with a little scripting.

Option 1:
inkscape filename.svg --export-ps=filename.ps
use share/extensions/ps2dxf.sh (which in turn uses pstoedit)

Option 2:
It might be possible to do it using the FileSaveAs verb but I don't know exactly how
see http://tavmjong.free.fr/INKSCAPE/MANUAL/html/CommandLine.html

Revision history for this message
helix84 (helix84) wrote :

Option 3:
Use the test.svg org.inkscape.output.dxf verb. But this will bring up a dialog with options so you will have to figure out how to supress it.

Revision history for this message
helix84 (helix84) wrote :

As a side note, I also found this alternative DXF output extension:
http://www.bobcookdev.com/inkscape/inkscape-dxf.html

Revision history for this message
su_v (suv-lp) wrote :

Option 1 requires pstoedit and creates DXF R12 files (Note: Inkscape doesn't import DXF R12 files). You can run pstoedit directly with your SVG files, instead of using the shell script "ps2dxf.sh" (a wrapper to handle the TEMP files used internally in the extension system).

Option 2 does not work automated: the verb 'FileSaveAs' does not take any arguments, it opens the file chooser dialog for 'Save as...'. (see bug #361237).

Option 3 does not work: it seems that input/output extensions are not available as verbs (only IDs of effect extensions). Both IDs fail when used on the command line:
ID of DXF R13 export: "org.ekips.output.dxf_outlines",
ID of DXF R12 export, using pstoedit: "org.inkscape.output.dxf"

The mentioned alternative DXF export extensions are no workaround for this feature request (and not better than the DXF R13 export in current trunk).

Option 4 for a workaround (untested) might involve modifying a copy of the export extension to make it available as effect, and thus callable from the command line as verb (which has different limitations as for example no access to name and path of the original file).

The solution would be in the implementation of bug #361237: “Provide scriptable method of saving files”.

Changed in inkscape:
status: New → Confirmed
su_v (suv-lp)
tags: added: dxf
Revision history for this message
Johan Engelen (johanengelen) wrote :

maybe there should be an export option that recognizes the file extension and searches for the corresponding output extension... ?

Revision history for this message
Johan Engelen (johanengelen) wrote :

"output extension" means something like "plugin"

Revision history for this message
Peter Mora (morapeter) wrote :

Up. I would use this (converting svg to dxf from command line) in my laser cutting workflow.

Thanks,
 Peter

Revision history for this message
Helge Wurst (h+lge) wrote :

I'd love to use this to generate 3D models from PCB layouts for FEM simulation.

Revision history for this message
Nathan Lee (nathan.lee) wrote :

Closing as part of migration of bugs to GitLab (http://alpha.inkscape.org/bug-migration/)

The more generic version of this issue (just adding the SaveAs options to the CLI rather than dxf specfically) is being tracked on GitLab in https://gitlab.com/inkscape/inbox/-/issues/2121

Changed in inkscape:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.