Convert selected GDS geometry into a KiCad .kicad_pcb board file.
The converter uses KLayout to read and polygonize GDS shapes, then writes KiCad PCB objects using kicad-pycbnew. GDS polygons are emitted as KiCad zones with cached filled_polygon data, so downstream exports can use the generated filled geometry without asking KiCad to recalculate zone fills.
Example output generated from example.gds:
Python 3.12 was used during development. The runtime dependencies are normal Python packages installed from PyPI via pip:
klayoutkicad-pycbnew
Create a virtual environment and install the project dependencies from pyproject.toml:
python3 -m venv .venv
. .venv/bin/activate
pip install .No separate KiCad GUI application package is required to run the converter itself. KiCad is only needed if you want to open the generated .kicad_pcb file graphically or validate/export it with kicad-cli.
Convert the included example GDS file:
python gds2pcb.py example.gds example.kicad_pcbIf no arguments are provided, the script uses those same defaults:
python gds2pcb.pyConvert another GDS file:
python gds2pcb.py input.gds output.kicad_pcbThe current defaults are tailored for the prototype process stack:
| GDS layer/datatype | KiCad output |
|---|---|
3/0 |
filled zone on In1.Cu |
6/0 |
filled zone on F.Cu |
7/0 |
filled zone on F.Mask |
2/0 |
blind via from B.Cu to In1.Cu |
4/0 |
blind via from In1.Cu to F.Cu |
The default generated net name is empty.
Map GDS polygon layers to KiCad layers:
python gds2pcb.py input.gds output.kicad_pcb \
--layer-map 3/0=In1.Cu \
--layer-map 6/0=F.CuMap GDS via layers to KiCad via layer pairs:
python gds2pcb.py input.gds output.kicad_pcb \
--via-map 2/0=B.Cu,In1.Cu \
--via-map 4/0=In1.Cu,F.CuSet a KiCad net name:
python gds2pcb.py input.gds output.kicad_pcb --net-name /GND- GDS boxes, polygons, and paths are all converted through KLayout's
shape.dpolygonrepresentation. - KiCad native via objects are circular. For each GDS via polygon, the converter uses the bounding-box center and
min(width, height)as the via diameter. - The via drill defaults to
diameter - 10 µm; adjust with--drill-shrink-um. - Generated zones include both
polygonand matchingfilled_polygonsections. Avoid manually refilling zones in KiCad if you need to preserve the exact GDS-derived fill geometry. --flip-yexists for coordinate-system experiments, but the default is no mirroring.
The converter itself only writes the KiCad PCB file. The preview.svg image in this README was generated from the converted board using KiCad CLI:
python gds2pcb.py example.gds example.kicad_pcb
kicad-cli pcb export svg example.kicad_pcb \
--output preview.svg \
--layers F.Cu,In1.Cu,B.Cu,F.Mask \
--page-size-mode 2 \
--exclude-drawing-sheetKiCad / kicad-cli is only needed for opening, validating, or exporting the generated .kicad_pcb file; it is not needed to run gds2pcb.py.