This skill should be used when the user asks to "make a case / enclosure / box for my board", "3D-print a case", "cutouts for the connectors", "drill drawing for a project box" or "fit the board in a DIN-rail case". It builds a printable two-part case or the cutout drawing for a bought box from the KiCad board file.
3 stars
0 votes
0 copies
1 view
Added December 1, 2026
ai-agentspythongo
Security analysis
A92/100
mediumInstalls packages at runtime which could introduce malicious dependencies
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Enclosure Design?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gkochievi-enclosure-design)
---
name: enclosure-design
description: This skill should be used when the user asks to "make a case / enclosure / box for my board", "3D-print a case", "cutouts for the connectors", "drill drawing for a project box" or "fit the board in a DIN-rail case". It builds a printable two-part case or the cutout drawing for a bought box from the KiCad board file.
user-invocable: false
---
# Enclosure design
`scripts/enclosure.py` reads the KiCad 10 board file: the Edge.Cuts outline, the mounting holes, each part's courtyard and its 3D model's height. Connectors whose courtyard reaches the board edge get a cutout in the wall they face.
## 1. Read the board first
- Find the board file (`hardware/<Name>/<Name>.kicad_pcb` in generated projects). Check the `.lck` file: a board open in KiCad may have unsaved edits.
- Ask what the case is for when it is not said: indoor desk unit, wall or DIN-rail mount, outdoor or wet (a car-wash bay is wet and chemical: see `references/enclosure-design.md` section 4), which connectors face outward, which LEDs and keys must be visible or reachable.
- Heights come from the 3D models. Set `KICAD10_3DMODELS` to KiCad's 3D model folder when it is not in a usual place; parts without a model fall back to a table of typical heights, and the script lists them. Give the real heights from the part drawing with `--height REF=MM`.
## 2. A 3D-printed case
```sh
python3 scripts/enclosure.py case hardware/Board/Board.kicad_pcb --lid-hole LED1 --lid-hole SW1:4
```
Writes into `enclosure/` next to the board (or `--out`):
| File | Content |
|---|---|
| `case.scad` | the tray and the lid as OpenSCAD source: render, or set `part = "tray"` / `"lid"` and export STL |
| `case_tray.step`, `case_lid.step`, `.stl` | the solids, when CadQuery is installed (`pip install cadquery`) |
| `case.json` | outer and inner size, standoff and board height, screws (size, length, count), each cutout and lid hole |
| `case_preview.svg` | top view with the board, standoffs and cutouts, and the four walls seen from outside |
How the lid is held (`--lid-fix`, default `auto`):
- `corners`: screw posts in the four corners, on the axis whose two walls have no connector (the case grows by one post on that axis). Self-tapping screws from the lid.
- `through`: screws from under the floor, through the standoffs and the board's mounting holes, into posts that come down from the lid; the board is clamped between them. Chosen when every pair of walls has a connector.
- `lip`: the lid's lip only (glue, tape or a tight fit).
The screw size follows the board's mounting holes (2.7 mm → M2.5, 3.2 mm → M3) unless `--screw` is given; `--insert` makes holes for heat-set inserts instead of self-tapping pilots. Main dimensions: `--wall`, `--floor`, `--lid`, `--clearance` (board to wall), `--top-clearance` (tallest part to lid), `--standoff`, `--fit` (lip gap), `--radius`.
Report to the user: outer size, screws to buy (size, length, count, kind), the warnings, and the parts whose height was guessed. Show `case_preview.svg`. Tell them to print one test (or just the tray at 20 % height) and check the connectors before printing the final case.
## 3. A bought box (plastic project box, DIN-rail case)
```sh
python3 scripts/enclosure.py box board.kicad_pcb --box-inner 100,60,35 --box-wall 2.5 --box-floor 2.5 --standoff 6
```
`--box-inner` is the inside width, depth and height from the box maker's drawing (take the smallest inside size where the walls have draft). The board is centred unless `--offset X,Y` places it (move it toward the wall its connectors face: a connector should end within about 1 mm of the wall). Writes `box_cutouts.svg` and `box_cutouts.dxf` (each wall seen from outside, measured from its bottom left corner; the floor seen from inside with the drill holes), `box_cutouts.csv` and `box.json`. Standoffs of the `--standoff` height are bought separately (metal or nylon, the screw size of the holes).
Do not invent a box part number or its dimensions: ask for the box the user has or wants, or take the inside size from the maker's own drawing.
## 4. In the generated project
`kicad-generator/generator/build.sh` runs `enclosure.py case` after the board is routed when the project's `config.py` sets `ENCLOSURE = dict(...)` (keys are the option names: `lid_hole`, `height`, `lid_fix`, `wall`, ...), and `publish.sh` copies `enclosure/` into the project.
## Rules
- Every dimension is a starting point: printers, materials and boxes differ. Say so, and give the parameter to change.
- Heights from the table are guesses; list them and ask for the part drawing values when a guessed part sets the case height or a cutout.
- Never overwrite a user's edited `case.scad` without asking: write a new `--out` folder or check the file first.
- Wet, dusty, outdoor or chemical environments need more than a printed case: follow `references/enclosure-design.md` section 4 and say what the printed case does not give (sealing rating, UV and chemical resistance).
## References
- `references/enclosure-design.md`: printing settings and tolerances, screws and inserts, connector cutouts, sealing for wet places, bought boxes and DIN-rail cases.
## Next step
When this is done, say what comes next: print or cut one sample and check the fit; a connector that moved goes back to the board (`kicad-generator` or `kicad-projects`).