diff options
| author | Louis <louis@dnge.de> | 2026-11-11 10:08:41 +0100 |
|---|---|---|
| committer | Louis <louis@dnge.de> | 2026-11-11 10:08:41 +0100 |
| commit | 2e433fcd0d1afadd8ab786dd30d7d4546bdee43d (patch) | |
| tree | f2a5603703d56b08c1eaa672eaf529ec4b2cc3fa /knowledge/tooling/model-check.md | |
| download | hw-toolchain-2e433fcd0d1afadd8ab786dd30d7d4546bdee43d.tar.gz | |
hw-toolchain: placer, routers and KiCad helpers for agent-driven hardware work
Rust placer (simulated annealing) and negotiated-congestion router for
2-layer KiCad boards, pnr.sh to place, route, DRC-check and install
candidates, Python KiCad helpers, repo conventions (AGENTS.md) and the
tool documentation under knowledge/. Konnect (KiCad MCP, AGPL) as a
submodule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'knowledge/tooling/model-check.md')
| -rw-r--r-- | knowledge/tooling/model-check.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/knowledge/tooling/model-check.md b/knowledge/tooling/model-check.md new file mode 100644 index 0000000..a4ae99c --- /dev/null +++ b/knowledge/tooling/model-check.md @@ -0,0 +1,21 @@ +# Model check + +`tools/model_check.py` checks a footprint's 3D model placement against its pads, without opening KiCad. + +``` sh +tools/router/.venv/bin/python tools/model_check.py libraries/footprints/HW.pretty/<name>.kicad_mod [-D HW_LIB=...] +``` + +- **Transform:** it reads the footprint's `(model …)` offset, scale and rotation, loads the STEP file's vertices and applies KiCad's transform: scale, then rotate X, Y, Z (KiCad negates the angles), then offset. 3D Y points up, footprint Y points down. +- **Output:** the model's extent and height, and for every drilled pad (THT, NPTH) the distance to the nearest model feature below the board surface (pin tips, pegs, shell legs). + - Good: every hole within about 0.1 mm, body bottom at z ≈ 0. + - "Nothing below the board surface" means the model is upside down or floating. +- **When to run it:** on every new footprint with a model, especially ones converted with easyeda2kicad. Their offsets and rotations are often wrong; seen on a MagJack (2.2 mm off in y) and a USB-C receptacle (rotated 180° about X, standing on its mating face). +- **SMD-only parts:** it cannot match holes. Check those with `kicad-cli pcb render` ([KiCad notes](kicad.md)). +- **Assemblies** (manufacturer STEP files with coloured sub-parts, [3D models](../topics/3d-models.md)) are refused. Flatten a copy with FreeCAD, point a scratch copy of the footprint at it and check that. Keep the original in the library. freecadcmd treats arguments as files to open, so pass paths through the environment: + +``` sh +STEPFILE=in.stp OUT=flat.step freecadcmd -c "import os, Part; s=Part.read(os.environ['STEPFILE']); Part.Compound(s.Solids).exportStep(os.environ['OUT'])" +``` + +Related: [KiCad notes](kicad.md). |
