Unfortunately, interoperability between these tools was less than ideal.
KiCAD export formats
- Gerber/Excellon: Stable and reliable
- DXF: Generates one file per layer. Drill hits can be plotted as Xs, but there's no obvious way to plot hole boundaries. Seems to sometimes generate polygons which are not closed (missing the last vertex).
Sonnet import formats
- DXF: Standard feature with all (paid) Sonnet editions. Expects one file, with a separate pen type for each conductor or drill layer. Minimal tolerance to malformed files.
- GDSII: Extra-cost option, but reasonably priced (about 25% of the cost of L2 Basic)
- Gerber/Excellon: Extra-cost option, absurdly priced (five digits). Only runs on Windows, not available in the Linux edition at all. Apparently this is because it's a third-party conversion tool they license as a binary, so they have no ability to port it or offer less extravagant pricing.
I spent a while tinkering and came up with a flow using KLayout that seems to work well, so I thought I'd do a quick writeup so other folks could benefit from it. This might be of interest to users of other PCB CAD tools as well. Although KLayout is nominally an IC mask layout editor, it can also read Gerber!
Step 1: Gerber generation
Step 2: KLayout import
On the next page, make sure the database unit is 1.0 micron. Coordinates are rounded to multiples of the database unit internally, so it needs to be small enough to avoid round-off errors. Microns are the most convenient unit to use with Sonnet's DXF importer.
Check the "merge polygons" box. This flattens all overlapping polygons, which is important because KiCAD likes to generate extra gerber flashes in vias and zone fills.
While not merging, or merging in Sonnet, will ultimately produce the same simulation result, Sonnet's geometry editor (xgeom) gets really slow if your geometry has too many polygons. Flattening before Sonnet sees the board avoids this.
Now the gerber conversion is done! Click "import" and you should see the PCB in the KLayout editor view.
Step 3: KLayout export
Select File | Save As. Choose file type DXF and pick a file name. Select "no compression", scaling factor 1.0, database unit 1 micron, and polygons as POLYLINE.
Step 4: Sonnet import
On the next page, select units as microns.