Files
kicad-layout-replicator/README.md

55 lines
2.4 KiB
Markdown

# KiCad Layout Replicator
A KiCad PCB editor plugin that replicates component placement across hierarchical sheet instances.
## Concept
When a schematic uses multiple instances of the same hierarchical sheet (e.g. four identical amplifier channels), you can place and arrange one instance manually, then use this plugin to copy that exact layout to the other instances — preserving relative positions and rotations.
## Workflow
### 1. Replicate component placement
1. Open **Layout Replicator** from **Tools → External Plugins**
2. Pick a **source sheet** (the fully placed reference layout) and a **target sheet**
3. Pick a **reference component** from the source sheet — this acts as the anchor point
4. The corresponding component in the target sheet defines where the copy should land and at what orientation
5. Hit **Apply** — all other components in the target sheet are placed using a rigid body transform: rotated around the source reference position, then translated to the target reference position
The reference component in the target sheet must already be placed — it defines the destination and orientation of the replicated layout.
Note: this only moves components. Traces and vias are not copied.
### 2. Replicate traces and vias
To bring the routing across as well:
1. In the source layout, select all the traces and vias you want to replicate
2. Copy and paste the selection
3. In the properties of the pasted selection, clear the net assignment (set to no net)
4. Move the selection into position over the target components — traces will reconnect automatically, vias will remain unconnected
5. Select just the vias
6. Run **Assign Via Nets from Nearest Copper** — this assigns each via to the net of the closest copper item, reconnecting them
## Installation
Symlink the plugin directory into your KiCad scripting plugins folder:
```bash
./local-deploy.sh
```
Or manually:
```bash
ln -sf "$(realpath plugins/layout_replicator)" ~/.local/share/kicad/9.0/scripting/plugins/layout_replicator
```
Then in the PCB editor: **Tools → External Plugins → Refresh Plugins**
The plugin appears as **Layout Replicator** under **Tools → External Plugins**.
## Component matching
Components are matched across sheet instances using the symbol UUID from the hierarchical path — the last segment of `GetPath()`. This is identical for equivalent components across all instances of the same sheet, regardless of their assigned reference designators.