mtl / svg2mod

Convert Inkscape SVG drawings to KiCad footprint modules
Creative Commons Zero v1.0 Universal
236 stars 56 forks source link

Default size factor is not 1:1 #17

Closed zirafa closed 6 years ago

zirafa commented 6 years ago

I've drawn an SVG to scale in Inkscape (90 DPI), but when importing into KiCad the result is not 1:1 (1mm in Inkscape = 1mm in KiCad), the output is actually slightly larger. It ends up being something like 1:1.06665.

To correct for this, I have to use -f .93751464867 to my svg2mod command. Am I missing something obvious, or is this a bug?

EsserPrototyping commented 6 years ago

I also realized that problem. I´m not very familiar with phyton, but maybe this has to do with the svg-parser. It would be great if somebody can clarify this.. the script itself is super useful!

Tom-Archer commented 6 years ago

Same issue here, thanks for the scaling factor @zirafa - I might have a poke around the svg-parser to see if there's anything obvious.

Tom-Archer commented 6 years ago

Ok, so I think I've found the issue. At several places in svg2mod.py it makes reference to the Inkscape DPI being 90. However it seems that in Inkscape 0.92 the default document resolution was changed from 90 to 96. As it turns out, 90/96 = 0.9375 which is pretty much spot on the scaling factor @zirafa stated.

Hopefully it's just a case of changing your document resolution to 90 (or alternatively tweaking the code). I may submit a PR later to add DPI as a command line option if I get chance.

mtl commented 6 years ago

Should be fixed in 0b7103b212a26fddc344418daacf961ae14c448a. Thanks, all.