Gerber to kicad_mod

Right, you have to convert everything to path elements. You can use Inkscape for that.

Use Inkscape’s “Path->Object To Path” and “Path->Stroke To Path”
menu options to convert these elements into paths that will work.

Sometimes there are further challenges in converting to path:

I tried that, but I still get:

Warning: Path segment has only 2 points (not a polygon?)
    Writing polygon with 1 points

The footprint looks bad, with very thin lines and without the pads.

That’s just a warning. But yeah, if the result is no good then you might be out of luck. It could be a lot of work to make this method give good results.

1 Like

I am trying with this perl one liner and seems to be able to convert from kicad_pcb exported from GerbView to kicad_mod:

perl -pe 's/(\s*)\(segment(.*)\s\(net\s0\)/\1(fp_line\2/g; s/(\s)\(via(.*)\(size\s([0-9.]+)\)\s(.*)/\1(pad ~ thru_hole circle\2(size \3 \3 )(drill 0.6) \4/g; s/\s*\((?:kicad_pcb|(?:layers\s\W)|\d).*//g;  s/^\s*(?:\))?\r?\n//g; eof && do{chomp; print "$_)"; exit}; print qq{(module ModuleName\n(layer F.Cu)\n(at 0.000000 0.000000 0.000000)\n(descr "Module Description")\n$_} if $. == 1;' RF.kicad_pcb > RF.kicad_mod
1 Like

Sorry, this message won’t be useful. Just expressing a little frustration that one has to jump through so many hoops to get this working. Implementing import of simple shapes, or shapes designed somewhere else (printed antenna in CST, or transmission line transitions and some sort of RF filters) should not be that painful.
I’m glad the community is able to figure it out in the end!

There’s this now too:

This script is for use from within inkscape and thereby lets inkscape do the conversion of paths for export to line segments, unlike svg2mod, which is standalone and uses its own library.

This script converts 1px to 1 mil.

Summary, it is subtly different in terms of results vs svg2mod, and does not expect to be given polygons. It simply converts paths, and doesn’t try to do anything clever such as allocating distinct layers in the exported footprint.

One of the scripts will export gEDA pcb .fp format, which Kicad can load directly.

Cheers,

Erich.

1 Like