Better Better DXF Output for Inkscape (layers!)

I started using Inkscape, a sweet open-source vector graphics program, to produce (and/or steal from the internet and convert) designs suitable for carving on the CNC as Inkscape has a plugin to export the file as a .DXF. Converting some files, I discovered the current export script does not correctly handle all types of transforms, so some parts of the file may export out-of-proportion to each other or in strange size units regardless of the drawing units of the original drawing (Inkscape’s internal drawing unit is apparently equal to 1/90 of an inch, wait, wtf?). Also, if the drawing contains curved (Bezier) lines, these will be exported more or less as-is (DXF splines) and many free/cheap/itch-scratch-ware programs will not handle the resulting file (since the ‘correct’ representation or interpretation of splines is never disclosed in the published DXF file specifications, so everyone kind of does them in their own way, with less-than-stellar results).

Bob Cook noticed these limitations and updated the script to fix many of the ‘unusual transforms’ scaling issues, and convert Beziers to standard polylines that any program will import. It also adds some support for layers, including special ‘drill’ layers whose drawing objects will be output as single points (no lines) for hole drilling.

In theory, the layer support as he implemented it ought to work (it’s correct and in conformance with the DXF spec, which allows drawing objects to be assigned to arbitrarily-named layers throughout the file). In practice, many of the same free/OSS, low-cost and weekend-warrior tools do not handle this any better than splines. I dug up a copy of the DXF spec, played around a bit and found that these programs expect all layers to be formally declared in a DXF LAYER table in the header section of the file before use. So here is an update to the export script that generates a proper LAYER table, allowing a wider variety of toolpath generating programs to import them correctly. So far it has been tested with ACE Converter and CamBam and seems to work well, but as always this is a quick n dirty, not exhaustively tested script and there is no lifeguard on duty. (Inspect the imported files for problems before commanding your big machine to cut them!)

Better Better DXF Output for Inkscape

Just unzip into your \Inkskape\share\extensions directory. Note that the updated ‘’ replaces an existing file.

Note: There is still an outstanding issue with Grouped objects in Inkscape being exported with incorrect size. As I understand it (assuming the document structure sent to export scripts is substantially an SVG file), transforms are applied at the Group level, which is sort of a container that has the actual drawing objects (and possibly further nested groups) as its children. Guessing that to handle this correctly, rather than looking for transforms at the node itself, it must also maintain a stack of transforms that have been applied at the node’s parent level, and parent’s parent, etc. For now, it is an easy workaround to ungroup everything before export. Maybe someone with freetime can update this and release it as ‘Better Better Better DXF Output’ :-) (b3dxf?)

Tags: , , , ,

25 Responses to “Better Better DXF Output for Inkscape (layers!)”

  1. Markus says:

    THX a lot for the script! Just what i needed to design some simple forms for CNC with CFK-platters. Hopefully it will work out as i plan it :-)


  2. Andrew says:

    Very good, thanks for your addition! I am just getting into inkscape and noticed that all of the DXF lines are output with the same color. The DXF palette has 256 possible colors, perhaps there is a way to export to DXF using the best match of a palette color?

  3. John Beale says:

    Thanks very much for the script! It works as expected. Unlike the 0.46 built-in “Desktop Cutting Plotter DXF” output which does not work (gives me broken lines covering only about half of my path, for some reason.)

  4. peter says:

    The 0.47pre1 has some DXF improvements, does this script include those changes? Will this be submitted as a patch to inkscape?

  5. Dave says:

    I tried this extension with mixed results. Tried opening the exported DXF in 3 CAD editors/viewers – Result
    Autodesk AutoCAD 2002 LT – Fatal Error!
    Autodesk DWG TrueView 2008 – Fatal Error!
    DWGeditor 2009 (IntelliCAD engine) – Opened

    However, none of the above CAD programs opened the original Inkscape DXF so the result is still better!

  6. Dave says:

    Further to my previous message…
    I converted a text to vector path, which I suppose must be grouped. Maybe that’s the problem. I tried again with some simple geometry (squares, circles), it seems no problem.

  7. Andy says:

    I have used this and it works great!! I have hundreds of svg files to convert. Is there anyway I can do this in a script outside of inkscape?

  8. rustysilo says:

    I have tried using this and opening the .dxf file in AutoCAD R2008, but I get this message on open:

    Missing Default entry 0 in SymbolTable:LAYER

    Invalid or incomplete DXF input — drawing discarded.

  9. Kannan says:

    I was having broken lines in the dxf exports and Better DXF export fixed this nasty problem.

    Thanks a lot.

  10. Chris Madsen says:

    I was getting errors using Ubuntu 8.10 and Inkscape 0.47–these were resolved by replacing xpath(path,inkex.NSS) with xpath(path,namespaces = inkex.NSS) in

  11. Andrew Poth says:

    I’m using Better DXF from Bob Cook’s site, and quickly noticed a problem. Inkscape 0.46 (on Ubuntu 8.10) assigns layer names such as “Layer 1” by default, with a space in the name. Better DXF takes these names unchanged, and when I try to import the DXF file into AutoCAD 14, it fails. I’ve been going through the DXF files with a text editor and performing a global search-and-replace to change all “Layer xx” type names to “LAYERXX” or “LAYER_XX” names, and then AutoCAD is happy. Another way to do it is to change the layer names in Inkscape, before exporting with Better DXF, but I don’t always remember to do it. The Python script should be tweaked to change names to all-uppercase and strip embedded spaces in layer names or substitute the underscore character during export from Inkscape, before building the layer table, thus avoiding this aggravation. Some others have noted AutoCAD DXF import problems here, and that may have been the cause.

  12. Simon Arthur says:

    I noticed some of the limitations of this tool and extended it to create DXF Export for Inkscape. It allows color output, fixes the layer names, runs correctly on more systems, outputs in inches, and shortens the length of the segments.

  13. Marc Woodlander says:


    is this script for the new inkscape 0.48. too?

    Best regards,


  14. Nick says:


    We’ve made another extension to generate Gcode straight from Inkscape.

    There are a lot of features such export Gcode for CNC Mills, Lathes, Plasma and Laser Cutters, scaling and orientations systems, etc.

    Extension available here

  15. CD says:

    Extension is (was :) ) very good.
    unfortunately it doesn’t work anymore in inkscape 0.48. Generated dxf files are broken,
    for example VisuallMill doesn’t read them at all.
    I use ubuntu version.

    Could you please, check what is the bug, and beybe fix it. Please!

  16. […] DXF R12 exporter, didn’t work for me either […]

  17. […] R13, but OpenSCAD can only read DXF R12. A number of plugins for Inkscape, including Better DXF and Better Better DXF, are aimed at solving the problem, but none of them worked for me. Another suggestion I came across […]

  18. […] a relieved carving of that logo. To begin with I pulled the jpg logo into Inkscape loaded with the Better Better DXF Output plugin. I used the Inkscape drawing primitives to trace over the major outlines of the logo […]

  19. Allen says:

    Would someone be willing to help a software neophyte install this script into Inkscape?
    It would have to be step by step instruction.
    When I say neophyte, I mean I’m clueless about how it’s done!
    I’m running Ubuntu 12.4

    Thanks, Allen

  20. MILORD says:

    Pour tous dessins 2D a exporter en 3D utiliser GRAPHICWORKS trés facile à utiltser en DXF pour OpenSCad

  21. Andreas says:

    Hi, is there a chance to get an updated version of this great plugin that works for Inkscape 0.91?
    Would be awesome…

  22. Andreas says:

    OK, I got it working with Inkscape 0.91!
    Needed a couple of changes in

    Find a fixed version here:

    Would you mind updating your zip?


  23. Jim says:

    once i download the zip how do i get it working in inkscape? thanks

  24. Abdul says:


    i know this is an old subject really and i hope that you still alive and in a good health but is it possible that you give me an example of using this “Verb” in the command line for example the directory of the file is

    “C:\Users\{user_name}\Desktop\225 1.pdf”

    and the output file is

    “C:\Users\{user_name}\Desktop\225 1.dxf”

    can you write the inkscape verb command line?

    thank you ;


  25. Fourdan says:

    I have unzip the file (B2..) in the right directory
    Now I see the save as “Better Better dxf ..”
    But when I try to transform an svg into B2dxf I get an error
    ‘Attribute error:’module’ object has no attribute ‘unittouu’
    Thanks for some help

Leave a Reply