SVG units and dimensions

Hi, my English is not very good but I’ll try to explain as best I can
I’d like to understand how Blender interprets units and dimensions of imported SVG files.
I make an example to explain better:
In Illustrator I create a simple square path that is 1000 x 1000 pixel. I export that path to Blender as a SVG file. I import the SVG file in Blender and now dimensions are become 0.282 x 0.282 with “Unit” settend as defoult on “Unit Presets”. If I switch “Unit” to “Meters” it shows me 28.223cm x 28.217cm… What??? The square is no more a square! It 'a rectangle! But this is not my biggest problem … My biggest problem is: what is the unit conversion or calculation through which Blender get those values?

Same expertiment but even more strange things with Inkscape. I create the same square 1000 x 1000 pixel. I export that path to Blender as a plain SVG file. I import the SVG file in Blender and now dimensions are become 0.938 x 0.937 with “Unit” settend as defoult on “Unit Presets”. If I switch “Unit” to “Meters” it shows me 93.8cm x 93.7cm… So even in Inkscape the square is no more a square… and the values are approximately 3 times bigger than Illustator svg…

I really need to understand how Blender handles SVGs units and dimensions. Can someone help me? Thanks a lot

If you’re interested in keeping dimensions on export/import, why don’t you work in dimensions in your vector graphics software?
Just tried creating a 10 cm x 10 cm square in Inkscape and it comes in (more or less) exactly as that into Blender (when set to metric units).

My guess is as follows: The conversion from 2D pixels into 3D dimensions is based on the 2D file’s dpi setting.
By default an Illustrator file is 300 dpi, while an Inkscape file is 90 dpi…

I’m sorry but I don’t undertand how you can obtain those values. If I create a 10 cm x 10 cm in Inkscape - Blender it shows me a square that is 35.434cm x 35.426cm with Meters unit. Realy different from your 10 x 10 cm values
I really don’t understand.
I perfectly undertand that inkscape / illustrator defoult exporting DPI is the key…
But I don’t understand how Blender interprets those dpi … what calculation transforms a 10 in a 35,434?? And whay…

Well, don’t ask me how it works… All I can say is that it works:

https://dl.dropboxusercontent.com/u/27650383/02-02-2017%2022-46-30.png

https://dl.dropboxusercontent.com/u/27650383/02-02-2017%2022-44-43.png

What versions of Blender/Inkscape do you use?

The last available for both :frowning:
I link a screencast of the operations I do

The only thing different from my workflow is that you change the file type (in Inkscape’s “Save As…” dialogue) from Inkscape SVG to Plan SVG. May I ask why?

If you save files with both settings and look at them with a text editor, you will find that the Inkscape SVG contains a definition of the file’s unit system (inkscape:document-units=“px”), while the Plan SVG does not. So I guess that Blender - in lack of a frame of reference - in the latter case just translates the nameless file’s units into its own.

Svg import addon, file import_svg.py contains


# TODO: "em" and "ex" aren't actually supported
SVGUnits = {"": 1.0,
            "px": 1.0,
            "in": 90.0,
            "mm": 90.0 / 25.4,
            "cm": 90.0 / 2.54,
            "pt": 1.25,
            "pc": 15.0,
            "em": 1.0,
            "ex": 1.0,
            "INVALID": 1.0,  # some DocBook files contain this
            }

And 90/25.4 = 3.54330708661

Don’t know why they assume 90dpi but in the Inkscape version I have (0.92+devel) doesn’t even have dpi setting in the document properties. It has view scaling with the value 1. Changing that to 90/25.4 (typing in the equation) it does the conversion properly.

Yeeeeeeaaaaaahhhhhh!!! Thanks so much JA12 !!! That was the key!! Problem solved !!!IkariShinji thanks to you too, I use plain svg cause I have read that it is more compatible with blender.
For example it maintains the proper Inkscape axis origin when you import the svg in Blender.
All the tutorials I’ve seen about exporting svg to Blender recommend to use plain svg format