Blender 2.57 has now well working SVG-import! This page is obsolete.

Inkscape SVG-import (update)

Unfortunately script will not work well with the latest Inkscape, since Inkscape started to use short forms of SVG commands. Hopefully I find time to fix this...

CHANGELOG:
29.9.2009

  • Added explicit conversion from string to float (didn't work with Blender 2.49)
3.10.2008
  • removed a non-ascii character from comment that prevented the script working in some environments (Thanks for Jean-Denis for pointing that out)
3.6.2007
  • script now separates paths by default (this gives more control of how curves behave when imported)
  • not closing (ie. making cyclic) open curves anymore
  • a small test file available (look download in this page)

Background

SVG-import didn't work well in earlier versions of Blender (< 2.43). I needed a working solution for importing architectural floor plans so I wrote this script.

Current svg-importer in 2.45 seems to work quite well. So you probably won't need this script.

However, if you have complex floor plan or svg-file with lot of text, you may want to try this script. It is fast and because it separates paths, the result is easier to edit. Or if you want to do something of your own with SVG-import, you may want to check this out. It is a quite clean SAX-parser to start with.

What is a path?

In SVG a path is a group of curves. This means that you can control which curves belong together. You can combine several curves as a single path in Inkscape with Combine-action (Ctrl+K). Note that grouping is totally different thing.

If you look the picture below, you'll see the difference when SVG is imported to Blender. The same file is imported twice (two stars with rounded rectangles). When the star shape is combined with rounded rectangle around it, it forms a one separate object (on the right). If file is simple, this really doesn't matter but in complex files this makes editing much more easier and faster (for example, try to edit the test SVG-file imported with current Blender-script).

paths

Imported test file after extrusion (look download). I added the colours to illustrate different paths.

Inkscape file imported 
and 
extruded

Here is a real life example of imported file. There was no need to modify curves. I just converted it to mesh and applied extrusion.

Usage

You need a full Python installation.

  • Place the script in your Blender scripts-directory (.blender/scripts).
  • Make your drawing in Inkscape and convert ALL objects to paths!
  • Save
  • Open Blender and choose File -> Import -> Inkscape2Curve.

SVG

Few notes:

  • It is not a full SVG import
    Currently my script uses a very small subset of svg path types (M,L,l,C,c,z).
  • Only matrix transformation implemented
  • Does not read short forms of commands (allthough it seems that Inkscape do not make them. Well, it does now ...)
  • All Lineto commands results vector handles, so there should be no hidden handles lying around.
  • The fill information is totally ignored
More information of paths in svg can be found here: http://www.w3.org/TR/SVG11/paths.html.

Download (.py and .svg )

Download the script from here: inkscape2curve_012a.py

Here is a little test file I use for testing:

Download: inkscape_blender_test_file.svg