Close

SVG to Eagle

A project log for Artistic PCB's

A place to record different drawing techniques and experiments for PCB art

adellelinadellelin 04/06/2020 at 14:530 Comments

One of the things I went through this weekend was to test the path of svg exports versus dxf exports and the solutions I've found out there. There is a popular site right now called svgtoeagle by gfwilliams . Most of the instructions such as Sparkfun's are for going from Gimp to Eagle and this doesn't work out of the box for Illustrator to Eagle due to the difference in the way svg's can be exported. With most tools on Illustrator, when you export the drawings to svg, they will. be exported as polygons whereas eagle is looking for path types. This post by vizzie about helped me dig into this further, but I still found missing the beginning steps. After going through multiple Illustrator forums and other blogs. I found a chain that works.

NOTE: This technique will always fill the shape, even if you don't close your path in Illustrator. So if you only want an outline, i would suggest using the dxf export technique.

Let's draw a shape in Illustrator. I create a new square artboard and change the units to millimeter - Illustrator - Preferences - Units. Use the Pen tool to draw your shape, here I'm tracing over a shield. As you add points, if you hold your click, the option will change to a black arrow. If you drag this arrow, it starts to create some handles. 

What you're drawing here is bezier curve, this is a much more complicated way to represent a line because now you're storing information on the x,y coordinates as well as the coordinates of the handles. Eagle currently doesn't utilize bezier representations and this is one of the reasons you can't bring curves directly into Eagle. You'll find a similar problem on a laser cutter. You can't cut a circle represented in bezier format directly, the laser will not actually see a shape at all. So now let's take a look at the representation of this shape in code. 

In the title tag, you can see that illustrator is exporting this shape with a path class, which is what we want Drawing a simpler shape, however, like a triangle, without making any curves, Illustrator will export this with a polygon class, this is something svgtoeagle will fail on. 

svg to eagle will have an error that says `Did you use Object to path in inkscape? No paths with fills or strokes found. One more step here is to turn the object to a compound path, and then it will be exported as a path class instead of a polygon. Object - Compound Path - Make

Now that we have our paths, there's one more step. If we bring them into svgtoeagle like this, the error message will be

The next step is to open the file in a text editor and add `fill="black"` in the path tag.

This is what it will look like in svgtoeagle. You may chose which layer you want this to appear, what trace width, the signal name and the scale factor.

Leave the output format option at board unless you want to use it in the Eagle Library tool.

You can either copy the script output, paste into the eagle console? and hit enter or download the eagle script with the button.

In eagle, if the execute script button is in your menu bar, chose that. Or File - execute script, select the script from Browse.

Discussions