Importing a Gerber

I have an old Gerber of a complex RF antenna and I wanted to import and modify it, somewhat - I have to add/modify mounting holes in a non-critical area.
Now, I tried loading it with Gerbview, and that’s fine.
However if I try saving it as Pcbnew the antenna reflector, which has a complex routing like a meander in a solid plane, this becomes completely filled. Then something goes wrong in saved Pcbnew file.
Is there any alternative free editor that I can try? Another conversion tool?
Note that in my case I have no physical component to mount on board, this is simply a naked PCB to modify slightly and manufacture.

You want to add some screen shots of what the gerber looks like and what PCB turns it into?

You’re lucky there is such a function as Gerbview / File / Export to Pcbnew… at all.
It is a quite a nice reverse-engineering tool, but it does not generate perfect results.

Your result in Pcbnew may look weird, but probably most or all of the coordinates are present. It is probably best if you do not try to use the back-import as-is, but to export it from Pcbnew to a .dxf file, check it and clean it up and make a real footprint from it which can then again be used in a KiCad project.

There is a: Footprint Editor / File / Import outlines from .DXF file.

Where and how the cleanup is best done may take some experimentation. Maybe you can do it in KiCad (But general graphics is not a strong point in KiCas). Maybe an external CAD program that can work with .DXF files is a better option.

There is some collaboration between KiCad and FreeCAD, with the “StepUp Workbench” in FreeCAD. It is quite powerful, but FreeCAD has it’s own learning curve…

This is what happens, sorry if I didn’t describe it with a picture

@paulvdh I understand it can’t be perfect, after all reverse engineering a lost design isn’t that easy.

I will try the DXF import in footprints, never used that before, and it makes sense that a reasonable way to use that is considering it a weird jagged pad.
I don’t do RF design, so I admit to be quite ignorant on this, but how would someone draw a design like this from scratch, in KiCAD? I mean, you don’t just fulfill a connection requirement, as interactively follow a ratsnest.
Well, if is there a KiCAD way to do it, as it seems reasonable that you follow better an RF design/simulation CAD to do it.

Looks suspiciously like a Hilbert Fractal.

bCNC has a generator for that, and it can also export as .dxf:

Just for fun I saved it and attached it:
2021-05-24_Hilbert.dxf (57.9 KB)

You do not have much visible in Pcbnew, which can have several causes. Maybe you have overlapping stuff, something went wrong with track widths or you have something on a layer that obfuscates all the other stuff.

You can switch off the visibility of layers in Pcbnew with the “Layers manager” on the right side of the screen, Just remove a flag in a checkbox to hide a layer.

On the far left side of the screen there are some icons for whether filled objects are fully painted, or only shown as outlines:
image
Maybe it makes more sense if you experiment a bit with those settings.

Tried to disable anything from the view but top layer, and apparently nothing changed.
To my surprise, the original fractal is there, though behind a filled area. Dragging that area’s sides the fractal shows… Now, that’s a wrong polarity (…) of the design, as the jagged fractal should be subtracted from the plane :thinking:

I find interesting your fractal generation, though I have no idea on the CAD that generated this one, as this is an old design. I was just told that’s been interactively designed and simulated from some RF specific tool :man_shrugging:

EDIT
Just for curiosity I tried the latest 5.99 nightly (same operations with Gerbview before and export to Pcbnew), but results are the same.
Inspecting with Gerbv seems that the original Gerber file is really defined that way. The outline is a filled area with a subtracted drawing, which in the conversion is still positive instead of negative on the layer (maybe this behavior isn’t even possible in KiCAD 5/5.99?)

Now, if I save my original top layer as SVG, and import in KiCAD 5.99 footprint editor, I can easily assign it to F.Cu layer, but still I can’t see my meander.
Even though the jagged internal polygon is present in SVG (checked with Inkscape and Edge), in the footprint editor looks like it’s always ORed (added) with all of its part, and never XORed (subtracted).

This is clear if I select “Show graphics items in outline mode” (left below) or not (right below).

How would you import a graphic item in a copper layer if it has an SVG drawing with some milled parts inside?
:thinking:

I know that Gerber files support “negative” features and layers, but KiCad itself does not use them as far as I know. This may also mean that this part of the gerber viewer in KiCad is not tested thoroughly, or maybe not at all. I remember a post about gerber files with negative features not being shown properly by Gerbview.

bCNC has the ability to create toolpaths with an offset to compensate for tool radius. You can use that as a start point for a zone-outline in KiCad. KiCad-nightly V5.99 has the ability to upgrade line segments into a zone outline.

Inkscape may also be able to create the negative of your Hilbert fractal and save or export it directly, but I have little experience in that area.

@paulvdh I have managed somewhat the conversion, didn’t try bCNC yet but I’ll give it a run.

What I did, and it looks promising even though a bit cumbersome is:

  • Open my Gerber files with Gerbv from gEDA. This tool has a nice option to export in SVG, among the others. For me (using the Windows binary), after some testing, the best working release is this portable from SourceForge version 2.7.0 https://sourceforge.net/projects/gerbv-portable/files/; otherwise refer to gEDA page http://gerbv.geda-project.org/
  • Installed in Inkscape the extension Svg2Shenzhen (maybe they could have called it Svg2KiCAD…); found it on GitHub https://github.com/badgeek/svg2shenzhen
  • Done the Extension / Svg2Shenzhen / Prepare Document… which arranges all the layers as required
  • Imported the SVG(s) in the proper layer (F.Cu, B.Cu); made sure that active area (copper) is black and void zones are white - this is required by the extension to work
  • Done the magic with Extension / Svg2Shenzhen / Export to KiCad…
  • Now I can open the file .kicad_mod from the footprint editor in a new component footprint, with File / Import Footprint from KiCad File…

Next step is to re-create pads where required, so that my component makes some sense.
I listed these notes hoping they can help someone else to speed up the same procedure - including myself in a short while, when I’ll have forgotten everything :sweat_smile:

On my RF antenna I have also a lot of via stitching, I guess that however that will reasonably has to be replicated when drawing the PCB itself, has no meaning making them pads (which looks to be the only way for plated holes in footprint editor).

I tested this both with KiCad 5 and 5.99, though for now, as a production ready PCB to share with colleagues, I’ll design it just with the stable release.

EDIT
I updated the link for Gerbv Portable

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.