My team is working on automating our export process, and one concern came up which I haven’t found a way to automate around.
When zone fills are out of date, the GUI gerber export button will warn you and prompt you to re-fill (or decline). When exporting gerbers via KiCad CLI, the user is not left any similar notice or warning.
I have looked through the custom DRC rules syntax and haven’t found a fitting set of rules which would fail given out-of-date zones on a layout. Similarly, I don’t believe there is currently an option in the CLI to re-fill the zones prior to exporting.
Is anyone aware of any workarounds for this? We would like to prevent our CI from allowing exports with accidentally outdated zones; either by failing the DRC test stage, or by re-filling the zones and writing to the kicad_pcb. We could then still fail the job with a git diff (or similar), instructing the author that the state at which they committed the layout has outdated zones.
kicad-cli is a relatively new utility, and some functionality is still “missing”. There is an open issue for this on gitlab, but Re-calculating internal zone geometry is apparently not on that list (yet).
A little test:
paul@cezanne:~$ kicad-cli pcb export gerbers
input: 1 argument(s) expected. 0 provided.
Usage: gerbers [--help] [--output OUTPUT_FILE] [--layers LAYER_LIST] [--drawing-sheet SHEET_PATH] [--define-var KEY=VALUE] [--exclude-refdes] [--exclude-value] [--include-border-title] [--no-x2] [--no-netlist] [--subtract-soldermask] [--disable-aperture-macros] [--use-drill-file-origin] [--precision PRECISION] [--no-protel-ext] [--common-layers COMMON_LAYER_LIST] [--board-plot-params] INPUT_FILE
Plot multiple Gerbers for a PCB, including the ability to use stored board plot settings
Positional arguments:
INPUT_FILE Input file
Optional arguments:
-h, --help Shows help message and exits
-o, --output Output file [nargs=0..1] [default: ""]
-l, --layers Comma separated list of untranslated layer names to include such as F.Cu,B.Cu [nargs=0..1] [default: ""]
--drawing-sheet Path to drawing sheet, this overrides any existing project defined sheet when used [nargs=0..1] [default: ""]
-D, --define-var Overrides or adds project variables, can be used multiple times to declare multiple variables.
Use in the format of '--define-var key=value' or '-D key=value' [nargs=0..1] [default: {}]
--erd, --exclude-refdes Exclude the reference designator text
--ev, --exclude-value Exclude the value text
--ibt, --include-border-title Include the border and title block
--no-x2 Do not use the extended X2 format
--no-netlist Do not generate netlist attributes
--subtract-soldermask Subtract soldermask from silkscreen
--disable-aperture-macros Disable aperture macros
--use-drill-file-origin Use drill/place file origin
--precision Precision of Gerber coordinates, valid options: 5 or 6 [nargs=0..1] [default: 6]
--no-protel-ext Use KiCad Gerber file extension
--cl, --common-layers Layers to include on each plot, comma separated list of untranslated layer names to include such as F.Cu,B.Cu [nargs=0..1] [default: ""]
--board-plot-params Use the Gerber plot settings already configured in the board file
I am not too familar with kicad-cli. Is there anything you can do with: --board-plot-params? I guess it makes you dependent on whatever the status of that checkbox is in the project.
It is an important feature for automated output generation, and thus worth a feature request.
Board plot params is one avenue I didn’t look into too deeply. I don’t think there is a board project setting which would mandate re-fill upon export, but I’ll take a deeper look. Thanks for the suggestion. If this does not yield what we’re looking for I’ll certainly put in a feature request, I think this would be a great feature to have for any teams utilizing the CLI.