Inkscape.org
Beginners' Questions Converting svg into dxf from command line
  1. #1
    sergejzr sergejzr @sergejzr

    Dear Inkscape community,

    My search for the topic didn't give results, so I decided to open a topic myself.

    I installed a brand new Inkscape 1.1 from snap on my Ubuntu and tried to convert a simple SVG to DXF using command line (the SVG just contains an oval). Whilst using the GUI the process runs perfectly, the console produces a quite empty file.

     

    inkscape --export-type="dxf" oval.svg

    I can not attach the original files to this post, but probably you can try to execute the line on a simple SVG and see the difference between the CMD and GUI outputs.

    Am I missing some options? 

    PS: To bring you in context, I started to work with command line as I would like to process a large amount of SVGs that are drawings I created for my RC Airplane (I would like to cut those parts with my laserCNC3040). I also need to export layers of an SVG into separate DXFs and mirror them for the plotter, but those are probably questions for separate topicd

  2. #2
    Polygon Polygon @Polygon🌶
    *

    No CL commander speaking here - but I have a guess; Maybe it´s not working because it needs probably more specification as Inkscape supports 2 dfx variants. (I avoid this file format whenever I can - it´s too picky. Maybe a CAD program will be more suitable for that task. I never managed too get a working DXF file for use in my 3d apps. They are not empty which the file size suggests - but not readable/interpretable. )

  3. #3
    inklinea inklinea @inklinea⛰️

    *** Please work on backups not originals****

    This should work - didn't bother to clip off the trailing .svg - so the output filename will be filename.svg.dxf

     

    for my_file in *.svg

    do 

    $(inkscape --actions="export-filename:$my_file.dxf;export-do;" $my_file)

    done
     

  4. #4
    sergejzr sergejzr @sergejzr

    @Polygon right, I am also quite new to CAD programs, but probably it is worth trying some of them if they can work with SVGs

    @inklinea Thank you, but it is giving the same empty document (if you open it again with inkscape)

     

    What one would expect is that the CMD behaves just exactly the same as the export function in GUI, however for some reason it seems not be the case. In GUI there are also some option asked on export (like units in pt or mm and Font encoding). The problem might be in missing those in command line.

  5. #5
    Polygon Polygon @Polygon🌶
    sergejzr

    Thank you, but it is giving the same empty document (if you open it again with inkscape)

    That might not work as a proof of concept; either check with a CAD-viewer or app or open with a Text-editor. And pretty much everything above a few bytes will have some content.

    The dxf files I generate with Inkscape won´t work in Inkscape again nor 3d Modelers, except CAD-Software like SolveSpace for instance.

  6. #6
    Tyler Durden Tyler Durden @TylerDurden

    DXF files from Inkscape can "round-trip" back in and out. Frequently, dxf files will have zero or very thin strokes which make the documents appear empty... view>outlines can help here.

  7. #7
    Polygon Polygon @Polygon🌶
    *

    This is from Inkscape saved to dxf/R12

    - I can view in CAD but no longer in Inkscape - regardless outline view or not - there´s no content one can select or Objects showing up in the list.

    This is the content checked in CAD:

  8. #8
    Tyler Durden Tyler Durden @TylerDurden

    R14:

  9. #9
    Polygon Polygon @Polygon🌶

    Ok - confirmed. R14 worked on export+import and segments are connected. Though no luck in 3d apps. No big deal as it handles SVG and PDF natively.

    Thanks for checking out @TylerDurden

  10. #10
    sergejzr sergejzr @sergejzr

    @TylerDurden Yes, GUI export works just fine, command line does unfortunately not. There are no lines, not even thin ones...

Inkscape Inkscape.org Inkscape Forum Beginners' Questions Converting svg into dxf from command line