architectural Inkscape import script (update)

Hi,
I made a new script for importing Inkscape drawings to Blender.

http://www.opendimension.org/blender3d_en/images/inkscape_import.jpg

Bad news:

  • you need a very recent cvs-build and full python install (not problem for Linux users though). For some reason, sax did not work with Blender 2.42a.

USAGE:

  • Change your drawing to PATH in Inkscape! (Path -> Object to path)
  • Use script to import

NOTE1:
This is NOT full svg-import! I wrote this because I needed working solution for importing architectural drawings from Inkscape: http://www.blendernation.com/2006/04/09/modeling-tutorial-using-inkscape-and-blender/.

You can download script from here: http://www.opendimension.org/blender3d_en/svg_import.php

I hope you’ll find this usefull! If you have problems, please let me know.
(Python is very new thing for me so there might be bizarre things in the script:o).

I haven’t tried it yet, but I know I needed correct SVG import :slight_smile:
Thanks man, I appreciate your work!!!

Just gave it a try, nice work. Can’t you make it check if the path has a fill before closing it?

I’ve never had any trouble importing with the standard “paths” import script. Just save from Inkscape as “plain SVG”, use the standard import method, make sure to “scale on height” when asked, then once the object is imported, select it then enter “Control-a” to clear the rotation and then you can extrude the imported object or do whatever you want with it.

spyres,
I don’t think you need to write stuff like that. Ubuntuist tried hard and made script that alot of folks needed and you make it sound like he just wasted time making new SVG import.
Standard script that comes with Blender does not work correctly.
So thank you, Ubuntuist!!!

This script looks great Ubuntuist. Thanks for your work and for sharing it. Please let us know of updates. :wink:

I’ve had pretty good luck with the inbuilt function. If there are glitches with it, I hope they fix that one rather than make us depend on yet another importer.

Inkscape2curve-script started
Traceback (most recent call last):
  File "Text", line 257, in my_function
  File "C:\Python24\Lib\xml\sax\expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "C:\Python24\Lib\xml\sax\xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "C:\Python24\Lib\xml\sax\expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "C:\Python24\Lib\xml\sax\expatreader.py", line 379, in external_entity_re
f
    self._source.getSystemId() or
  File "C:\Python24\Lib\xml\sax\saxutils.py", line 293, in prepare_input_source
    f = urllib.urlopen(source.getSystemId())
  File "C:\Python24\lib\urllib.py", line 77, in urlopen
    return opener.open(url)
  File "C:\Python24\lib\urllib.py", line 185, in open
    return getattr(self, name)(url)
  File "C:\Python24\lib\urllib.py", line 308, in open_http
    h.endheaders()
  File "C:\Python24\Lib\httplib.py", line 795, in endheaders
    self._send_output()
  File "C:\Python24\Lib\httplib.py", line 676, in _send_output
    self.send(msg)
  File "C:\Python24\Lib\httplib.py", line 643, in send
    self.connect()
  File "C:\Python24\Lib\httplib.py", line 627, in connect
    raise socket.error, msg
IOError: [Errno socket error] (10061, 'Connection refused')

have i forgotten something ?

Tested with a blender cvs compilation made yesterday …

How can you say that ? My own script has been tested on the complete openclipart library .

JMS, if your script works perfectly, I doubt others would write their own.
From looking at your code theres some improvements you could make, tho that can be said of many scripts. -
The method your using is also less flexible sine your using an intermediate format… svg->obj->blender rather then directly importing svg.
Any data that SVG has that OBJ cant be imported this way.

Just saying “My Script Works Fine!” - is not an attitude that will help you find and remove bugs. Why dont you ask for the SVG that caused the problem so you can debug and fix it?

This new SVG importer looks promising and hopefully can support generic SVG’s some day.

In short, use some healthy competition to find out areas to improve and fix, rather then being overly negative.

Ok. I don’t want to talk about it without facts :slight_smile: Here is .svg file and .blend file:

http://www.kot-in-action.com/files/shape01.svg
http://www.kot-in-action.com/files/svg_test.blend

When you open .blend file you will find path imported with Ubuntuist’s importer (smaller shape) and shape imported using JMS’s importer using obj as intermediate format (bigger shape, but you won’t find it because it’s awaaay from 0,0,0 and to find it you need to select all, if not selected, it’s not visible for some reason).

Ubuntuist’s importer does almost good job. Almost because shape was scaled by Y in Inkscape, but imported didn’t recognize scale and imported shape as if it would be not scaled.
JMS’s imported did crappy job. First of all why shape would be so off centered? Second of all why I can’t see it? Third - why does it have double vertices? The only good thing about it is that JMS’s importer recognized that fact that shape was scaled :slight_smile:
And it is very very simple shape.

So I am really anxious to hear respond from both developers :slight_smile: Thank you.

In the kml/kmz importer case, I already see what your “improve and fix” means .
My script does not need to be fixed but, perhaps, completed …

absurd : the script import the data at their right place, localized from the original page .
If the page is not centered in inkscape, they will not be in Blender too .

Second of all why I can’t see it?

if your svg file contents lines with thickness, the line are splited in the svg file .
Blender fills the space between this two lines . The import error would be to do not see the second line . To have a good svg export, remove the line thickness before .

Third - why does it have double vertices?

Same answer . It seems that you really do not know how the svg file works .

There : http://www.openclipart.org/ you could find a lot of non falsified files .
Try to compare the imports on this one, for instance :
http://openclipart.org/clipart//buildings/homes/abitazione_villa_con_gi_01.svg

Gentlemen I think we have been down this road before…
In passing comments about Blender things it is important not to be insulting of another’s contributions to the community or make personal remarks and criticism.
I don’t think it would hurt to be a little more considerate with opinions before publishing them.
We are all on the same side I think… :slight_smile:

Compare these two imports from the svg file i pointed above .

With the “new” svg importer :

Amazing, isn’t it ? As you can see there is an error in each imported curve ! And these were only simple paths without any complex command . More : there is no closed curve in the original svg file but all the curves have been closed in the import .

Now look at work made with the current importer :

As you can see all the curves are correctly drawn and they are not closed because the paths in the svg file are not closed .

Ubuntuist,
SVG file I provided below, imports mirrored by Y axis. Why is it so?

JMS,
I really don’t care about SVG files from OpenClipart, because I usually need to use my own SVG files. And since your importer is not working correctly, what do you want me to agree with?!
“…if your svg file contents lines with thickness…”
I don’t care about line thickness. If I have a single stroke, I want to see single path in Blender. That’s just a logically correct. If somebody needs “thick” line, then they have to design it properly. Here is SVG to show what I mean:

http://www.kot-in-action.com/files/example01.svg
http://www.kot-in-action.com/files/example01.blend

A is single stroke, no matter how thick it is in SVG, B is “thick line”. So that’s proper design :slight_smile:
And artist doesn’t need to know how SVG work in order to use Inkscape + Blender. Have you heard of WYSIWYG? That’s how it suppose to be. If you have a stroke in InkScape and it has thickness, it suppose to be imported either as single path or to converted to path and to become closed contour. But no double vertices please.

No comment . There is no double vertices in the import made by my script .

Have you heard of WYSIWYG?

And you ? did you heard of WYEIWYI ?
What You Export (from inkscape), Is What You Import (in blender)

That’s how it suppose to be.

In fact, what is supposed to be is that you know what you want to export . If you want to import a single path in blender try to learn how to export this sole path from inkscape .

I can’t understand that you don’t see the error (the last knot is simply removed) on each curve imported by the svg2curve script .