Big Blue Saw's DXF Export For Inkscape
Written by Simon Arthur   
Tuesday, 24 August 2010

Image

Update (2010-09-01): I've fixed a bug based upon a report from commenter blackfox. Download the new version of Big Blue Saw's DXF Export For Inkscape Here.

After the last article on using Inkscape, I received some feedback in the comments section that let me know that DXF export wasn't available for all versions of Inkscape. After a little research, I came across a the free third party Inkscape extensions for DXF export Better DXF Export and Better Better DXF Export.

But I found that these two solutions lacked a few important features:

  • There was a Python version incompatibility that caused the export to crash on Linux.
  • They only supported metric output as the measurement units.
  • When converting curves to line segments, the line segments were quite large, giving the curves a rough appearance.
  • Color output was unsupported.
  • They would produce layer names which were incompatible with many CAD packages.

With these problems in mind, I made a few modifications to Better Better DXF Output to create Big Blue Saw's DXF Export For Inkscape. It features everything from its predecessor, plus the following features:

  • It has been tested on Fedora Linux, as well as Windows Vista.
  • The units are now output as inches by default.
  • It creates finer line segments, which is important for achieving the highest accuracy possible.
  • The lines in the output file will be given the closest matching color in the DXF color palette.
  • Spaces in layer names will be replaced with the underscore character.

To install:

  1. Close down Inkscape.
  2. Download the ZIP file containing Big Blue Saw's DXF Export For Inkscape.
  3. Unpack the ZIP file into your Inkscape extensions directory: typically C:\Program Files\Inkscape\share\extensions on Windows or /usr/share/inkscape/extensions on Linux. (Mac users, help me out here.) You will need to overwrite the file simpletransformations.py with the version included in the ZIP archive.
  4. Restart Inkscape.

To use after you've installed Blue Saw's DXF Export For Inkscape:

  1. Create your drawing as normal.
  2. Ungroup all items by selecting everything (Ctrl-A or Edit | Select All from the menu) and then ungrouping repeatedly (Shift-Ctrl-G or Object | Ungroup) until all groups are broken apart.
  3. Convert all objects to paths. You can do this items by selecting everything (Ctrl-A or Edit | Select All from the menu) and then pressing Shift-Ctrl-C or choosing Path | Object to Path from the menu.
  4. Choose File | Save As from the menu. In the dialog box that appears, choose "Big Blue Saw DXF Output" and click the Save button.

    Image

One more thing, for those reading this far. Most of the time when I, personally, want to get a DXF from a file loaded in Inkscape, I save it as an EPS, and convert to DXF using the pstoedit package. This preserves splines and curves, which is nice, but requires the use of a command-line tool, which isn't for everyone.

Download Big Blue Saw's DXF Export For Inkscape Here

Share | |
Comments
Add New Search
blackfox  - great work but ...   |2010-08-28 17:38:09
... I think there is a bug in the script or at least an existing problem:
I
tried to convert a complex drawing but the python-script run endless (over one
hour!). Tryed with a simple one for testing and everything was ok, so I tryed
removing parts till the problem dissapeared => it seams that it has to do with
path-attributes "sodipodi:nodetypes"... I would be very very glad if
that could be fixed!
Big Blue Saw Administrator   |2010-08-28 21:36:47
I can take a look at it. E-mail me the problem drawing: simon@bigbluesaw.com
.
M Griffin  - Adjusting parameters / units in your scripts?   |2010-08-31 14:11:46
Your script adjustments are just great. Already, I'm able to get Inkscape vector
graphics into QCAD (my DXF tool of choice) quite easily. I'd like to make
adjustments to your script so that I can stick to mm (as I'm creating gcode for
a pen plotter with this tool, and am working with mm for the print stage). Also,
I'd love to make adjustments to the length of the lines that replace the circles
and such. Any suggestions?
I'm so excited that you are working on this right now
-- right when I had reached my limit with Inkscape DXF export frustration!
Big Blue Saw Administrator   |2010-08-31 14:16:08
I'll see what I can do. Right now I'm waiting to hear back from blackfox about a
fix to his problem.
Gordon   |2010-09-02 09:08:04
Thank you from Ireland
Best wishes
Mifga  - how about now?   |2010-09-07 12:57:46
Just checking back to see if you have suggestions about making the length of
lines interpreting circles/arcs an adjustable parameter as well as offering an
mm export option (instead of inches). Thanks! Matt
Big Blue Saw Administrator   |2010-09-07 13:37:47
I'm working on it as I can and will update this page with the details of any
updates. As far as the length of the lines, try changing the line

self.flatness
= 0.01

in inch_dxf_outlines.py
Laz  - Designer   |2010-09-23 00:18:04
is there a plugin for Inkscape 0.48 that will save my file to dxf or dwg.
that
I can (import)open in autocad or sketchup?
I tried (better better DxF export
and it
will not convert my svg file to dxf.

regards Laz
Big Blue Saw Administrator   |2010-09-23 00:33:47
Did you try Big Blue Saw's DXF Export for Inkscape, as described on this very
web page?

If that doesn't work, you could try opening the created file in QCad,
re-saving, then opening the resulting file in whatever software you want.
Ben   |2010-11-09 04:21:26
Thanks for the tip on pstoedit! I've been playing around with all sorts of
convertors and software, and that worked immediately for me :)
Wes  - Worked Great   |2010-11-15 12:26:43
This worked great for me. I was having a lot of trouble with the built in dxf
tool making curves way to many lines and it killed my cnc to run them. Ran
yours and it worked great.

Thanks
will1384   |2011-01-03 08:10:42
Quote:
Unpack the ZIP file into your Inkscape extensions directory: typically
C:\Program Files\Inkscape\share\extensions on Windows
or /usr/share/inkscape/extensions on Linux. (Mac users, help me out here.)


Under OS X, it's in 

Inkscape.app/Contents/Resources/extensions/
will1384   |2011-01-03 09:26:33
I get this when I try to save something
with the "Big Blue Saw's DXF
Export"
under OS X.

Quote:
The fantastic lxml wrapper for libxml2 is required by inkex.py and
therefore this extension. Please download and install the latest version
from http://cheeseshop.python.org/pypi/lxml/, or install it through
your package manager by a command like: sudo apt-get install python-lxml


I Googled it and found a few
web pages,

http://blog.lrem.net/2010/07/05/fixing-ink scape-python-ex
tensions/

and 

http://caih.org/open-source-software/fixing-inks cape
-in-mac-os-x/

I was not able to fix Inkscape v0.48,
after trying the steps
on both pages,
I also ended up trying a development build of Inkscape,
and when trying to
save it just crashes after a long pause with
"Inkscape encountered an internal and will close now".

I guess
I will try Inkscape...
Chris  - Syntax error saving as dwf from Inkscape 0.45   |2011-01-06 10:18:18
I'm a complete noob but trying to convert a simple line drawing (wmf) to dxf so
it can be sent to a CNC machine. I opened the wmf in Inkscape, broke apart,
object to path (as per instructions) but I get a blank dxf file and this error
in a window -


Traceback (most recent call last):

File
"share\extensions\inch_dxf_outlines.py ", line 23, in ?


import inkex, simplepath, simpletransform, cubicsuperpath, cspsubdiv,
inch_dxf_color, dxf_templates_inch, re, simplestyle

File "C:\Program
Files\Inkscape\share\extensions\in ch_dxf_color.py", line
3

class DxfColor():

^

SyntaxError: invalid
syntax



Any ideas?
Chris  - Syntax error saving as dwf from Inkscape 0.45   |2011-01-06 10:18:56
I'm a complete noob but trying to convert a simple line drawing (wmf) to dxf so
it can be sent to a CNC machine. I opened the wmf in Inkscape, broke apart,
object to path (as per instructions) but I get a blank dxf file and this error
in a window -


Traceback (most recent call last):

File
"share\extensions\inch_dxf_outlines.py ", line 23, in ?


import inkex, simplepath, simpletransform, cubicsuperpath, cspsubdiv,
inch_dxf_color, dxf_templates_inch, re, simplestyle

File "C:\Program
Files\Inkscape\share\extensions\in ch_dxf_color.py", line
3

class DxfColor():

^

SyntaxError: invalid
syntax



Any ideas?
Big Blue Saw Administrator   |2011-01-06 15:21:16
1. Test to see if you get this error when starting with a brand new file. This
will tell you if DXF Export For Inkscape is working at all.

2. You may have to
export to an intermediary format (like EPS), then close and re-open the newly
exported file, and finally export to DXF. I have seen this technique clear up
problems with files that have unusual properties.
andrewatdmr  - still not ACA2009 friendly   |2011-03-18 00:43:15
I'm trying to convert B/W images into Autocad 2009 lines. I need to be able to
export for a variety of cnc and other applications preferably from autocad.I
keep getting (in autocad) an error like this:
"Error 372 in drawing header
on line 16.
Invalid or incomplete DXF input -- drawing discarded."

that
line in the DXF is:
"$INSUNITS"

Any idea how to fix this?

info's:
(xp
pr0 sp3)(inkscape 0.48.1)
I open inscape and drop in my png. I do bitmap trace
(on brightness). I check nodes and delete original. I "save as" and type
.DXF at the end of the name. I have yet to get any DXF export to work with
autocad. (tried yours, best, B2, R12)

I can open them in Corel, but i isn't
very efficient to go through 4 programs, each applying some conversion.

(btw,
thanks for your version of dxf at least i'm not having to replace all layer
names anymore or fix the pv files)
Big Blue Saw Administrator   |2011-03-18 01:44:10
I haven't really tested the output with AutoCAD.

If you're just doing tracing,
you might want to stick with GNU autotrace, which has a DXF output
option.

Finally, I have found that QCad accepts a wide variety of strangely
formatted DXF files, and saves them cleanly.
M  - inch to mm   |2011-06-06 13:11:07
Hello Simon,

Great improvement your dxf script
but over here we prefer to work
in millimeter.

what do i need to edit to turn inch to millimeter?

M.
Big Blue Saw Administrator   |2011-06-06 22:48:31
The original "Better Better DXF" did mm output. Look for the variable
"scale" in the file inch_dxf_outlines.py; that's what scales the drawing
to inches.
M  - quirks   |2011-06-06 13:16:50
I also discovered some other odd quircks. Like layers getting switched fron
their position. (or upside down?)
And for rectangles made with the rectangle
tool they are sometimes not processed, though when you select all and convert
object to path then they show up in programs that read dxf but the layer info is
getting lost.

M.
Big Blue Saw Administrator   |2011-06-06 22:52:14
Thank you for the bug report. A lot of these bugs are inherited from
"Better Better DXF". The things you mention aren't easy to fix, so it
may be a while before we are able to get to this.
linda   |2011-08-03 02:44:57
I wanted to convert my SVG file to a DXF (I'm using your big blue saw's export)
but when I opened it up in robomaster software it's very tiny in the left bottom
corner. Is there something I can do to import this DXF file to come in the
right size.

Thanks
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
Please enter the security code shown in the image.
 

Copyright 2005-2011 Big Blue Saw