I am trying to design a pcb which includes an RF part designed with an external software (CST for the antenna and ADS for the distributed part).
What I would like to do is to import different parts using a gerber into different footprints, p.e. a footprint for the antenna, a footprint for the matching network and so on.
I did not find any good way to make this systematically, hence that could be integrated into a workflow.
I will try to list the possible ways that I found.
Gerber [or whatever] to pdf or svg -> open that with Inkscape -> Change alpha channel to 255 (File -> Document Properties -> Background Color)-> export as bmp -> open it with bitmap2component -> export as kicad_mod -> substitute layer F.SilkS with F.Cu or B.Cu -> Open it with PCB footprint editor -> …
But I don’t find this workflow good enough, because the conversion from vectorial -> raster -> vectorial loses some resolution.
Gerber -> open that with GerbView -> export to PcbNew -> ???
The problem is that I don’t know how to convert the kicad_pcb to kicad_mod.
I tried by copying the segments by opening it as text, but I get a parsing error.
The questions are:
Is the S expressions for kicad_mod different from kicad_pcb?
Where can I find a resource for both syntax?
Is there a tool for the conversion between both, even in python, or python module, or as a script?
As a quite separate question, is there a resource on python scripting in kicad and/on by using some dedicated module in a (standalone) python interpreter?
Actually, GerbView can export to kicad_pcb, but not to kicad_mod.
My issue is converting from kicad_pcb to kicad_mod.
Any Gerber would be fine for the purpose, but if you need one random gerber I can upload it (not the RF one, which is still not ready, but the process should be the same).
The workflow I am using in based on 1. [in my question] and using a 2400dpi png, but this is not optimal.
Uhm, ok.
Some manual refinement is needed, it is difficult to get everything creating a script.
The vias are quite used when designing microstrip lines, in order to get shorted stubs and so on, but these does not need to be numbered pads, so maybe some "fp_circle"s on all copper layers are ok.
The discrete smd components needs square pads, so maybe some “fp_lines” with the right size are ok.
Then the ports can be directly inserted from the footprint editor or by adding “pad” (as you did) in the right place, but this second method is an overkill for me, I can add them manually in the editor.
Hence some manual editing is not easy to be avoided, but it would be easier with official complete documentations.
I guess you don’t have the kicad_pcb S-expression specification, but only for the kicad_mod (unofficial, in the link you provided and that I downloaded). I tried to search for the first, but I can not find it anywhere.
Maybe the procedure using bitmap is still easier and probably with the same final result.
Don’t you need a plated through hole? if you only have circles you don’t get that.
You could use “~” as pad number. This is used for pads that should not be connected to anything. (mounting holes, …)
Because your connections are done with lines this could work.
First of all, you can add or subtract features from the gerber within the gEDA project gerbv viewer.
Once you have the features you want in a gerber file, you can try running it through
which can create a gEDA PCB/pcb-rnd compatible footprint from a gerber, i.e. as shown here
which you can then import into kicad.
IIRC, the converter doesn’t deal with arcs, but kicad doesn’t routinely support arcs on copper anyway. Flashed apertures like pads may not be converted either due to the lack of detail in a gerber file as to the function or purpose of a specific feature.
Gerbers with painted features, i.e. from Eagle, are quite bulky and less useful once converted.
If you must have a .mod file, another way to go about it is to convert the entire gerber to a gEDA PCB/pcb-rnd footprint, and load it into a new layout in pcb-rnd (available at http://repo.hu/projects/pcb-rnd/ or as a debian/ubuntu package). In there, the footprint element can be broken up into constituents, and the useful bits retained. These can then be cut into the paste buffer, converted to an element, and pasted back onto the layout. The layout can then be exported in kicad format, and the bespoke footprint you have just created will be exported in the kicad layout as a module,
One possibility might be gerber-to-svg and then svg2mod but there is a lot of potential for things to go wrong with multiple steps. I know that gerber-to-svg generates a lot of <use> tags and I am not sure svg2mod even supports those.
No, I was supposing it was included in python, hence I did not clone the repo but just download the svg2mod script.
Now, after cloning the repo and with python 3.6, I get some errors:
Warning: Path segment has only 2 points (not a polygon?)
Writing polygon with 3 points
Unsupported SVG element: Circle