gfwilliams / svgtoeagle

Online SVG to Eagle CAD converter
MIT License
86 stars 27 forks source link

Issue reading SVG from Affinity Designer #15

Closed ericboxer closed 4 years ago

ericboxer commented 4 years ago

I've created a couple of designs in Affinity Designer that seem to not read correctly. I'm happy to share those privately.

gfwilliams commented 4 years ago

This is just something I've done for free to help others out - I'm afraid I'm a bit busy now and I don't have time to debug this. I'd suggest you just load the SVG file in Inkscape, then save it, and see if that works?

Otherwise if you find out what the problem is and want to contribute a change then I'm very happy to pull that in.

damianvila commented 2 years ago

Hi, @ericboxer I know this issue is closed, but I'm an Affinity Designer user myself, and if you want to export from AD, you need to do a little work.

First of all, ungroup all shapes. Set your units to mm, and look for the dimensions of the document in mm, and write it down somewhere (you're going to need it later). Now export as SVG normally.

Designer doesn't put millimiters as a unit in SVG, only pixels, and it doesn't add a fill for elements, you need to set it yourself.

So open the exported SVG in any code or text editor, and you'll see with="100%" height="100%", replace those with your width and height in mm, like with="8mm" height="4.5mm" (using the real dimensions you got from the program).

Now you need to add a fill to each path, so search for style="fill-rule:nonzero;" and replace it everywhere with style="fill-rule:nonzero;fill:#000;, and you'll have your SVG ready to import in this tool. Cheers!