KiCad plugin to merge (or create) a sub-pcb-layout into (or from) a top-level board.
Inspired by SaveRestoreLayout and HierarchicalPcb, but this plugin only uses the board layout file and does not require a schematic or any project structure. Compatible with schematic-less flows as long as the requirements below are met.
| Select anchor footprint ... | ... invoke plugin ... | ... profit |
| ... or save sublayout
as an editable .kicad_pcb file, restore-able to another board |
- Select and save the layout of a hierarchical block to a .kicad_pcb file.
- Selection includes traces, vias, and zones of internal nets.
- Selection expands to layout groups enclosing the footprints.
- This file can be edited.
- Restore a saved layout to a hierarchical block of a board.
- This includes footprint positions, traces, vias, and zones.
- Optionally delete existing internal traces and groups (if applicable) before restoring
- Replicate a layout of a hierarchical block to other instances of that block in the same board.
- Best-effort restore when the footprints or netlists do not match, allowing partial restores when the hierarhical sheet schematic has changed.
- Select ONE anchor footprint.
- For saving: select any footprint in the hierarchical block to be saved.
- For restoring: select the footprint in the hierarchical block where the layout will be restored around.
- For replicating: select the footprint of the source hierarchical block corresponding to the footprints of the instances where the layouts will be replicated around.
- Invoke the plugin from the plugin menu or toolbar.
- If needed, change the level of hierarchy to operate on. By default, the lowest (leafmost) hierarchical block is selected.
- Optionally, select multiple instances of the hierarchical block to replicate or restore.
- Click 'Save', 'Replicate' or 'Restore' to perform the operation.
TODO: make available on the KiCad plugin / package manager
Clone this repository into your KiCad plugins directory.
- On Windows, this is typically
C:\Users\<username>\Documents\KiCad\8.0\scripting\plugins, and if cloned correctly, this file should exist:C:\Users\<username>\Documents\KiCad\8.0\scripting\plugins\SubLayout\plugin.py.
The plugin is invokable from the Tools > External Plugins menu.
- Sublayouts work on hierarchical sheets.
- For non-schematic flows (e.g., hardware description language to netlist to layout), netlists must encode hierarchy in footprint tstamp (component unique id) data and provide Sheetfile and Sheetname.
- Component unique IDs must match when restoring or replicating sublayouts.
- For non-schematic flows, this means footprint tstamp data must match.
- Note, in the future, there may be an option to match components on refdes.
- Sheetname inference may fail if there are hierarchical sheets with no direct footprints. This may result in not finding other instances of a hierarhical sheet and is a limitation of the data available in the board layout file.