kicad-splitplane 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kicad_splitplane-0.5.0.dist-info/METADATA +181 -0
- kicad_splitplane-0.5.0.dist-info/RECORD +8 -0
- kicad_splitplane-0.5.0.dist-info/WHEEL +5 -0
- kicad_splitplane-0.5.0.dist-info/entry_points.txt +3 -0
- kicad_splitplane-0.5.0.dist-info/licenses/LICENSE +21 -0
- kicad_splitplane-0.5.0.dist-info/top_level.txt +2 -0
- kicad_splitplane.py +961 -0
- kicad_splitplane_mcp.py +172 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kicad-splitplane
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Split a KiCad power layer into one continuous copper zone per net
|
|
5
|
+
Author: Aleksandar Tuzlak
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://people.ee.ethz.ch/~atuzlak/kicad-splitplane
|
|
8
|
+
Project-URL: Source, https://github.com/atuzlak/kicad-splitplane
|
|
9
|
+
Keywords: kicad,pcb,power-plane,split-plane,voronoi,eda,mcp
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: shapely>=2.0
|
|
16
|
+
Requires-Dist: numpy>=1.22
|
|
17
|
+
Requires-Dist: scipy>=1.8
|
|
18
|
+
Requires-Dist: matplotlib>=3.5
|
|
19
|
+
Provides-Extra: mcp
|
|
20
|
+
Requires-Dist: mcp>=1.2; extra == "mcp"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# kicad-splitplane
|
|
24
|
+
|
|
25
|
+
Split a KiCad power layer into **exactly one continuous copper zone per voltage**, computed from where your vias are.
|
|
26
|
+
|
|
27
|
+
**[Documentation →](https://people.ee.ethz.ch/~atuzlak/kicad-splitplane)**
|
|
28
|
+
|
|
29
|
+
**Available in [KiCad](https://www.kicad.org)'s official Plugin and Content Manager**: search for *kicad-splitplane* and press Install ([listing](https://gitlab.com/kicad/addons/metadata/-/tree/main/packages/ch.ethz.atuzlak.splitplane)).
|
|
30
|
+
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
On a 4-layer board the inner power layer is often shared by several supplies (5V, 3.3V, 1.8V…). Each supply needs its own zone, and each zone has to
|
|
34
|
+
|
|
35
|
+
- contain every via and through-hole pad of its net,
|
|
36
|
+
- contain nothing of the other nets,
|
|
37
|
+
- be **one continuous surface**.
|
|
38
|
+
|
|
39
|
+
Drawing those outlines by hand is trial and error. kicad-splitplane does it for you and writes the zones straight into a copy of your `.kicad_pcb`.
|
|
40
|
+
|
|
41
|
+
## Quick start
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
git clone https://github.com/atuzlak/kicad-splitplane
|
|
45
|
+
cd kicad-splitplane
|
|
46
|
+
pip install -r requirements.txt # shapely>=2.0, numpy, scipy, matplotlib
|
|
47
|
+
|
|
48
|
+
python kicad_splitplane.py examples/demo_board.kicad_pcb --nets +5V +3V3 +1V8
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
On your own board:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python kicad_splitplane.py board.kicad_pcb --list-nets # find the supply nets
|
|
55
|
+
python kicad_splitplane.py board.kicad_pcb --layer In2.Cu --nets 5V 3.3V VBUS
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This writes `board_splitplane.kicad_pcb` (your board plus the zones; the original is untouched), `board_splitplane.png` (preview) and a copy of the project files (`board_splitplane.kicad_pro`/`.kicad_prl`) that keeps your design rules and shows every zone in its preview colour. Open the new board in KiCad, press **B** to fill the zones and run DRC.
|
|
59
|
+
|
|
60
|
+
Or install it as a command from PyPI:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install kicad-splitplane
|
|
64
|
+
kicad-splitplane board.kicad_pcb --nets 5V 3.3V VBUS
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
(The latest development version: `pip install git+https://github.com/atuzlak/kicad-splitplane`.)
|
|
68
|
+
|
|
69
|
+
## KiCad plugin
|
|
70
|
+
|
|
71
|
+
The same tool also runs inside the PCB editor (KiCad 9 or newer). It works on the open board, shows a preview and writes the zones directly into the board as **one undo step**, so Ctrl+Z removes them again.
|
|
72
|
+
|
|
73
|
+
1. In KiCad: **Preferences → Plugins → Enable KiCad API**.
|
|
74
|
+
2. Open the **Plugin and Content Manager**, search for **kicad-splitplane** under *Plugins* and press **Install**, then **Apply Pending Changes**. It is listed in [KiCad's official plugin repository](https://gitlab.com/kicad/addons/metadata/-/tree/main/packages/ch.ethz.atuzlak.splitplane), so KiCad offers new versions as updates there.
|
|
75
|
+
Offline, or to try a version before it is listed: download `kicad-splitplane-<version>-pcm.zip` from the [releases](https://github.com/atuzlak/kicad-splitplane/releases) and use **Install from File…** (uninstall a zip-installed copy before installing from the list, so updates work).
|
|
76
|
+
KiCad installs the Python dependencies on first use, which takes a minute.
|
|
77
|
+
3. In the PCB editor, click the **Split power plane** toolbar button, pick the layer and nets, press **Preview**, then **Apply**.
|
|
78
|
+
|
|
79
|
+
The dialog has the same options as the command line. It uses the wxPython that ships with KiCad, so nothing else needs to be installed.
|
|
80
|
+
|
|
81
|
+
For development, link the folder into KiCad's plugin directory instead of installing the zip (e.g. `~/.local/share/kicad/10.0/plugins/`, or `~/.var/app/org.kicad.KiCad/data/kicad/10.0/plugins/` for the Flatpak; a Flatpak cannot follow a symlink, so copy the folder together with `kicad_splitplane.py` there), or run `python plugin/splitplane_action.py` while KiCad has a board open.
|
|
82
|
+
|
|
83
|
+
## Options
|
|
84
|
+
|
|
85
|
+
| Option | Default | Meaning |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| `--layer` | `In2.Cu` | Copper layer to split |
|
|
88
|
+
| `--nets` | | Supply nets that share the layer |
|
|
89
|
+
| `--list-nets` | | Print supply-like nets with their via / SMD pad counts |
|
|
90
|
+
| `--gap` | 0.5 mm | Copper gap between neighbouring zones |
|
|
91
|
+
| `--edge` | 0.5 mm | Clearance to the board edge |
|
|
92
|
+
| `--min-neck` | 1.0 mm | Warn where a zone gets narrower than this |
|
|
93
|
+
| `--res` | 0.5 mm | Routing grid. If a via gets trapped, try 0.3–0.6 |
|
|
94
|
+
| `--include-smd` | off | Treat SMD pads as vias: preview **before** you place the power vias |
|
|
95
|
+
| `--no-smooth` | off | Keep the raw grid outlines instead of smooth 0°/45°/90° edges |
|
|
96
|
+
| `--plain` | off | Skip connecting the vias (faster, may create islands) |
|
|
97
|
+
| `--keep-old` | off | Keep existing zones of these nets on the layer (default: replaced) |
|
|
98
|
+
| `--no-colors` | off | Don't colour the nets in the copied project file |
|
|
99
|
+
| `--out` | `<board>_splitplane.kicad_pcb` | Output file |
|
|
100
|
+
| `--json` | off | Print one JSON object instead of text: `ok`, zones per net (`parts`, `area_mm2`, `seeds`), `warnings`, `log` and the written `files`. Same files and exit codes; errors give `{"ok": false, "error": ...}`. With `--list-nets`: the nets as JSON |
|
|
101
|
+
|
|
102
|
+
Exit code is `0` when every net got one clean zone, `1` when there are warnings.
|
|
103
|
+
|
|
104
|
+
## Use with AI agents (MCP)
|
|
105
|
+
|
|
106
|
+
kicad-splitplane includes an [MCP](https://modelcontextprotocol.io) server, so AI agents (Claude Code, Claude Desktop, Cursor, VS Code, …) can split power planes for you: "split In2.Cu between +5V, +3V3 and +1V8 on board.kicad_pcb".
|
|
107
|
+
|
|
108
|
+
Add it to your client as a stdio server (needs [uv](https://docs.astral.sh/uv/)):
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"mcpServers": {
|
|
113
|
+
"kicad-splitplane": { "command": "uvx", "args": ["kicad-splitplane-mcp"] }
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Claude Code: `claude mcp add kicad-splitplane -- uvx kicad-splitplane-mcp`. Without uv: `pip install "kicad-splitplane[mcp]"` and use the command `kicad-splitplane-mcp`.
|
|
119
|
+
|
|
120
|
+
It has two tools:
|
|
121
|
+
|
|
122
|
+
- `list_power_nets(board_path, all_nets=False)`: the supply-like nets with their via/THT and SMD pad counts, and the copper layers.
|
|
123
|
+
- `split_plane(board_path, nets, layer="In2.Cu", gap, edge, min_neck, res, include_smd, plain, keep_old, out_path)`: the same as the command line; returns the result as with `--json`. It always writes a new board (`<board>_splitplane.kicad_pcb` by default) and never overwrites the input.
|
|
124
|
+
|
|
125
|
+
The agent cannot fill zones or run DRC; open the new board in KiCad, press **B** and run DRC afterwards. Agents that read skills can use [skills/kicad-splitplane/SKILL.md](skills/kicad-splitplane/SKILL.md), which describes the whole workflow and what to do about each warning; [llms.txt](llms.txt) is a short overview for language models. Scripts can use `--json` or `sp.summary(result)` instead.
|
|
126
|
+
|
|
127
|
+
Each release is published to the [MCP Registry](https://registry.modelcontextprotocol.io) as `io.github.atuzlak/kicad-splitplane` and to PyPI as `kicad-splitplane` and `kicad-splitplane-mcp`.
|
|
128
|
+
|
|
129
|
+
## How it works
|
|
130
|
+
|
|
131
|
+
1. **Seeds.** Read the board (a small S-expression parser, no KiCad needed) and collect every via and through-hole pad of the chosen nets that reaches the layer, plus the outline from Edge.Cuts. All other vias, pads and holes on the layer (signals, GND, mounting holes) are read with their real size as obstacles.
|
|
132
|
+
2. **Spines.** For each net, join all its vias with a tree of 45° paths on a grid (Prim's algorithm with Dijkstra). Paths keep clear of other nets' vias and pads and of spines routed before, never squeeze through gaps too narrow for copper (e.g. between header pins), avoid passages narrower than `--min-neck` and prefer the middle of free space. All routing orders of the nets are tried; the one with the fewest trapped vias and the shortest spines wins.
|
|
133
|
+
3. **Split.** Every pad and via keeps a ring of its own net around it. Every other grid cell goes to the nearest spine, measured around obstacles rather than through them, i.e. a Voronoi diagram of the spines instead of the vias. A region grown from one connected spine is connected. The borders are then simplified together (so neighbours keep a shared border) and bent into 0°/45°/90° segments, keeping the exact grid border only around pads where the smooth one would cut a pad ring. The regions are clipped to the outline, shrunk by half the gap and written as KiCad zones.
|
|
134
|
+
4. **Check.** The tool estimates what KiCad will actually fill (zone minus clearance around other nets' copper) and warns about zones running over another supply's pad, pads/vias cut off from their zone, copper split by rows of pads, and necks narrower than `--min-neck`.
|
|
135
|
+
|
|
136
|
+
If a via is completely enclosed by other nets, no continuous split exists. The tool reports it and suggests where to move it:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
! 5V: via at (87.59, 56.06) is trapped by other nets -> move it to ~(92.60, 65.46) (10.6 mm fanout)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Library use
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
import kicad_splitplane as sp
|
|
146
|
+
|
|
147
|
+
text = open("board.kicad_pcb", encoding="utf-8").read()
|
|
148
|
+
r = sp.process(text, "In2.Cu", ["5V", "3.3V", "VBUS"], gap=0.5)
|
|
149
|
+
|
|
150
|
+
print("\n".join(r.log))
|
|
151
|
+
open("board_split.kicad_pcb", "w").write(r.board_text)
|
|
152
|
+
sp.render_png(r, "preview.png")
|
|
153
|
+
sp.summary(r) # {"ok": ..., "zones": {...}, "warnings": [...], "log": [...]}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Website
|
|
157
|
+
|
|
158
|
+
`web/` contains the documentation page; `python web/make_figures.py` renders its figures. `./deploy.sh` builds it as one self-contained file (`dist/kicad-splitplane.html`), `./deploy.sh --serve` previews it locally, `./deploy.sh user@host:public_html` uploads it.
|
|
159
|
+
|
|
160
|
+
## Tips and limitations
|
|
161
|
+
|
|
162
|
+
- Awkward zones usually mean awkward via placement. Keep each net's vias grouped and use short fanout tracks.
|
|
163
|
+
- Signals on the neighbouring layer use the split plane as return path; avoid routing them across the gaps.
|
|
164
|
+
- Zones are written as outlines without holes. Smaller zones get a higher priority so an enclosed island still fills; check the order in KiCad's Zone Manager.
|
|
165
|
+
- The command line tool is tested with KiCad 10 files; KiCad 7–9 net syntax is supported too. The plugin needs KiCad 9 or newer. Arcs in the outline are approximated, blind/buried vias are handled roughly.
|
|
166
|
+
|
|
167
|
+
## Tests
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
python -m pytest tests/ # plugin tests run when kicad-python is installed, MCP tests when mcp is
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Feedback and contact
|
|
174
|
+
|
|
175
|
+
Found a bug, have an idea for an improvement, or interested in collaborating? Write me an email at [atuzlak@ethz.ch](mailto:atuzlak@ethz.ch). Issues and pull requests are welcome too.
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT, © 2026 Aleksandar Tuzlak
|
|
180
|
+
|
|
181
|
+
<!-- mcp-name: io.github.atuzlak/kicad-splitplane -->
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
kicad_splitplane.py,sha256=giodCIB_V2fTFeqr5-4D6drXyB0O-cO2fDqfsr_Q8eY,42443
|
|
2
|
+
kicad_splitplane_mcp.py,sha256=56Wikd-eDtofhwNw_BURM20l8Yu1YVIwQs40yezjP3Y,7453
|
|
3
|
+
kicad_splitplane-0.5.0.dist-info/licenses/LICENSE,sha256=IPOhl6IS43wQXgrCF1cKnAMitpotnWwsRad3eAmtrO8,1074
|
|
4
|
+
kicad_splitplane-0.5.0.dist-info/METADATA,sha256=inh8jQs7QwH2boCWF30EYZSx9d3vFFGCIEUF85IlNYs,11030
|
|
5
|
+
kicad_splitplane-0.5.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
6
|
+
kicad_splitplane-0.5.0.dist-info/entry_points.txt,sha256=qhQx-PkH_oUICNwmhhePcAHHfLQmqSzmuvqxIUWj1IA,108
|
|
7
|
+
kicad_splitplane-0.5.0.dist-info/top_level.txt,sha256=eNuDzh9Y2pFqCchuBLuYHIwqnutQvBTOaiOm1uQdqn4,38
|
|
8
|
+
kicad_splitplane-0.5.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aleksandar Tuzlak
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|