Kicad operation reference
Generated from the current declarations. Do not edit this file by hand.
Types, limits and defaults below describe resolved values. Runtime expressions must produce these types. Unknown options are rejected; defaults apply only when omitted. Constructor options must be constant after document composition.
Index#
designRuleCheck, drillExport, inspectBoard
designRuleCheck#
Runs KiCad's native design rule check (kicad-cli pcb drc) on a captured copy of a saved board with every severity reported, and accepts the board only if the actual numbers of errors, warnings and unconnected items stay within the authored maximums. The board's own .kicad_pro rules and severities apply. Where the host model applies it independently predicts track/via clearance breaches and missing pad connections, which must match the native report. Outputs are board-summary.json, the native drc-report.json and board-statistics.json. Choose it before fabrication or after editing a board; exceeding a maximum fails the run with DRC_VIOLATIONS.
Common mistakes and assumptions:
- Global footprint libraries are not loaded, so library checks report lib_footprint_issues unless the project sets those checks to ignore; the summary lists every ignored check.
- Zones are checked as saved: the run never refills zones, so refill and save in KiCad first if fills are stale.
- Schematic parity is not checked; a board that passes here can still disagree with its schematic.
Native binding: kicad-cli pcb drc. Output kind: ["text"].
Inputs: none.
| Option | Meaning | Type / constraints | Default |
|---|---|---|---|
board |
Absolute path to an existing saved .kicad_pcb file. A sibling .kicad_pro (rules, netclasses, severities) and .kicad_dru (custom rules) with the same name are captured with it; KiCad only ever sees copies inside the run directory, so the original is never modified. | {"type":"string","minLength":1,"maxLength":4096} |
required |
maximumErrors |
Largest acceptable number of DRC violations with error severity (for example clearance, shorts, minimum annular width) in the native report. The run fails with DRC_VIOLATIONS when the actual count is larger; the report and summary are kept for review. Excluded violations are reported separately and never counted. | {"type":"integer","minimum":0,"maximum":100000} |
0 |
maximumWarnings |
Largest acceptable number of DRC violations with warning severity (for example dangling tracks or silkscreen overlaps) in the native report. The run fails with DRC_VIOLATIONS when the actual count is larger; the report and summary are kept for review. Severities come from the board project; checks set to ignore are listed but not counted. | {"type":"integer","minimum":0,"maximum":100000} |
0 |
maximumUnconnected |
Largest acceptable number of unconnected items (connections KiCad's ratsnest still shows as missing) in the native report. The run fails with DRC_VIOLATIONS when the actual count is larger; the report and summary are kept for review. Every routed net needs all of its pads connected by copper to reach zero. | {"type":"integer","minimum":0,"maximum":100000} |
0 |
drillExport#
Runs the same design rule check and, only if it passes the authored maximums, exports Excellon drill files with kicad-cli pcb export drill: decimal coordinates, absolute board origin, in millimetres or inches, with plated (PTH) and non-plated (NPTH) holes in separate files or one merged file. Every drill hit is read back independently and matched one-to-one to a board hole by position, diameter and plating. Outputs are the drill files, board-summary.json, drc-report.json and board-statistics.json. Choose it to produce the drilling data a board fabricator needs alongside layer plots from KiCad.
Common mistakes and assumptions:
- Excellon uses a y-up frame: a hole at KiCad board position (8, 10) mm is written X8.0Y-10.0.
- Only round holes spanning F.Cu to B.Cu are supported; slots, drill offsets, backdrills, blind/buried vias and drilled pads on back-side footprints are rejected before KiCad runs.
- No drill map, drill report or Gerber job file is produced; layer plots still come from KiCad itself.
Native binding: kicad-cli pcb export drill. Output kind: ["drill","text"].
Inputs: none.
| Option | Meaning | Type / constraints | Default |
|---|---|---|---|
board |
Absolute path to an existing saved .kicad_pcb file. A sibling .kicad_pro (rules, netclasses, severities) and .kicad_dru (custom rules) with the same name are captured with it; KiCad only ever sees copies inside the run directory, so the original is never modified. | {"type":"string","minLength":1,"maxLength":4096} |
required |
maximumErrors |
Largest acceptable number of DRC violations with error severity (for example clearance, shorts, minimum annular width) in the native report. The run fails with DRC_VIOLATIONS when the actual count is larger; the report and summary are kept for review. Excluded violations are reported separately and never counted. | {"type":"integer","minimum":0,"maximum":100000} |
0 |
maximumWarnings |
Largest acceptable number of DRC violations with warning severity (for example dangling tracks or silkscreen overlaps) in the native report. The run fails with DRC_VIOLATIONS when the actual count is larger; the report and summary are kept for review. Severities come from the board project; checks set to ignore are listed but not counted. | {"type":"integer","minimum":0,"maximum":100000} |
0 |
maximumUnconnected |
Largest acceptable number of unconnected items (connections KiCad's ratsnest still shows as missing) in the native report. The run fails with DRC_VIOLATIONS when the actual count is larger; the report and summary are kept for review. Every routed net needs all of its pads connected by copper to reach zero. | {"type":"integer","minimum":0,"maximum":100000} |
0 |
units |
Units of the coordinates and tool diameters written in the Excellon files: mm writes three decimals, in writes four. The summary and comparisons are always in millimetres. | {"type":"enum","values":["mm","in"]} |
"mm" |
separatePlating |
Whether plated (board-PTH.drl) and non-plated (board-NPTH.drl) holes go in separate files. When false, one board.drl contains both, with each tool marked plated or non-plated. | {"type":"boolean"} |
true |
inspectBoard#
Reads an existing saved KiCad board and reports what it contains: footprints by type and side, pads, through vias, nets, holes grouped by size and plating, the Edge.Cuts outline size, minimum track width, drill and track-to-track clearance. A dependency-free host reader computes these facts and KiCad's own board statistics report (kicad-cli pcb export stats) must agree with every one of them. Outputs are board-summary.json and the native board-statistics.json. Choose it to confirm what a board file contains before checking or fabricating it; it runs no design rules.
Common mistakes and assumptions:
- Only saved two-copper-layer boards in KiCad 8.0-10.0 format are read; newer, older, multilayer or unknown formats fail with UNSUPPORTED_BOARD rather than being guessed.
- Minimum track clearance follows KiCad's statistic: different-net tracks and vias compared on each item's primary layer only. It is a summary number, not a design rule check.
- Mounting holes and other footprints without through_hole or smd attributes are counted as unspecified components, as KiCad does.
Native binding: kicad-cli pcb export stats. Output kind: ["text"].
Inputs: none.
| Option | Meaning | Type / constraints | Default |
|---|---|---|---|
board |
Absolute path to an existing saved .kicad_pcb file. A sibling .kicad_pro (rules, netclasses, severities) and .kicad_dru (custom rules) with the same name are captured with it; KiCad only ever sees copies inside the run directory, so the original is never modified. | {"type":"string","minLength":1,"maxLength":4096} |
required |