From 2e433fcd0d1afadd8ab786dd30d7d4546bdee43d Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 11 Nov 2026 10:08:41 +0100 Subject: 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 --- knowledge/tooling/model-check.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 knowledge/tooling/model-check.md (limited to 'knowledge/tooling/model-check.md') 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/.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). -- cgit v1.3