small program that converts svg paths into gerber (RS-274X) files
Go to file
Samuel Bryner 3eb414687d Update gerber-types, no pre-release necessary anymore.
Fixes #1
2022-05-10 15:22:30 +02:00
docu Basic functionality is there :) 2019-01-24 22:46:30 +01:00
src Remove gnuplot stuff. 2019-01-24 23:11:36 +01:00
.gitignore Basic functionality is there :) 2019-01-24 22:46:30 +01:00
Cargo.toml Update gerber-types, no pre-release necessary anymore. 2022-05-10 15:22:30 +02:00
readme.md Link to gerbolyze, which really makes this project obsolete 2022-01-15 16:24:41 +01:00

readme.md

svg2gerber

Alternative: Have a look at gerbolyze, a much more polished tool for the same job!

This is a simple script that reads all path's in an SVG and converts them into a Gerber-file (also known as RS-274X; this is used to manufacture printed circuit boards).

  1. usvg is used to read and simplify the SVG.

  2. All paths are flattened using lyon.

  3. The resulting polygons are sorted from outside in and exported to Gerber by translating them into alternating dark and clear shapes.

Limitations

This script was hacked together for another project of mine where I needed to draw some layers in Inkscape. It therefore does only the absolute minimum I required it to. Making it a bit more general shouldn't be too difficult though, however it is unlikely I will do this. So, keep the following things in mind:

  • Only filled paths are supported. No lines or outlines or anything. KiCad can already do that via DXF. But would be straightforward to implement.

  • Paths can't intersect each other or themselves. If they do this program will most likely crash. This could be fixed by pre-processing all paths by tesselating them in lyon and tracing the outlines.

  • All paths must be closed. svg2gerber probably crashes if unclosed paths are fed to it.

  • No support for Inkscape layers yet. This would require either a second

  • Gerber files actually contain annotations that describe what kind of layer a file contains. Currently, only basic support for different types like silkscreen etc. are implemented.

Usage

./svg2gerb input.svg [output.gerb [layer_type]]

If no output file is specified it will take the input filename and replace the extension with ".gerb".

If the output path is just "-" the Gerber data will be printed to stdout.

layer_type specifies what kind of metadata the output contains. This is optional but recommended to make it more clear for the manufacturer how to interpret your files. Possible values are (case insensitive):

  • F.Cu, B.Cu Copper layer, positive file polarity
  • F.Mask, B.Mask Solder mask, negative file polarity (i.e. the shapes specify areas that should not be covered in solder mask)