xsrf / easyeda-svg-import

Simple SVG Importer for EasyEDA PCB that doesn't convert everything to Comic Sans 😄
85 stars 8 forks source link

SVG from Adobe Illustrator won't import at correct size #27

Open finnglink opened 1 year ago

finnglink commented 1 year ago

Hey! I'm an absolute babyface PCB/Electronics designer, but I do graphics design. I'm working on getting some panels made using EasyEDA and your SVG Importer. However, I'm using Illustrator instead of Inkscape, and the import-scaling is off. I've setup the document as 72DPI in mm. If I import, i need to set the scaling at around 1.389 (actually 1,389319815999999999...) to get the measurements line up mostly. With 1.389 my 40.30mm PCB is 40.291mm, so that's fine.

While this works, I'm curious where that difference comes from. I'd just prefer my measurements being bang-on :D Does this have something to do with Illustrator always exporting SVGs at 72DPI (not changeable), while Inkscape uses 96DPI?

Thank you!

xsrf commented 1 year ago

I'm not sure. The extension doesn't really read or understand different units or scaling factors. It just reads the raw coordinates from the SVG file. Can you make a 10x10mm square and look at the file what the raw coordinates are? Or just upload it?

finnglink commented 1 year ago

This is a simple 10mm square from Illustrator to SVG:

https://pastebin.com/s1xJQCLw

If I import that to EasyEDA, it's 28.3x28.3mm

xsrf commented 1 year ago

Yeah, the raw value in the file is 28.3 for 10mm. so... 28.3 dots / 72 dots/inch * 25.4 inch/mm = 9,98 mm. Kinda close, I guess? And because EasyEDA works in 0.01 inch/unit you should use 0.01 inch/units / 72 dots/inch = 1.388888888889e-4 as factor. I may have lost four orders of magnitude somewhere 🤔 and now my head hurts 🥴 but 1.3888888888... seems correct. Hope this helps? You'll always get some conversion errors though... Is there any way to change it in AI?

ntr-tm commented 11 months ago

Hello, thanks a lot for the extension ! It saves my life :) I have a same size problem using also Inkscape but the 1.3888888888 ratio works fine. On the other hand when I import a svg file, it always imports inversed mirror shapes which I can fix them using flip and rotate options but it would be nice to fix that issue. Cheers

xsrf commented 11 months ago

Hello, thanks a lot for the extension ! It saves my life :) I have a same size problem using also Inkscape but the 1.3888888888 ratio works fine. On the other hand when I import a svg file, it always imports inversed mirror shapes which I can fix them using flip and rotate options but it would be nice to fix that issue. Cheers

Thanks :) Please open a new issue and include an SVG that causes the mirrored imports. I've never seen this.

jerrinjms commented 10 months ago

Hello, I was playing with SVGs from illustrator and stumbled upon the same scaling issue. Its a powerful plugin given the functionality, and 1.3888 scaling factor works for now but it would be great if it could be addressed at some point. Thank you!