hw-gridrouter
Two-layer grid router for KiCad boards: a Python API over a C A* core with rip-up and reroute, plus a macOS viewer that replays a routing run search by search. It routed the Bluetooth OBD-II dongle's real 4-layer board in about 11 to 17 seconds, where the pure-Python version took 16 to 38 minutes.
What it does and how it connects
hw-gridrouter is a two-layer grid (maze) router for printed circuit boards, written for Python scripts that generate KiCad boards. The A* search, the occupancy grids and rip-up run in C, loaded through ctypes, while bookkeeping and the per-net driver logic stay in Python. It takes no dependencies beyond standard-library Python 3.9+ and a C compiler, and it does not import pcbnew: it returns plain lists of segments and vias, with an optional helper that writes them into a KiCad board.
On the benchmark board in the README, the C core routes the whole board in 1.27 seconds against 84.9 seconds for the pure-Python version, about 67 times faster with an identical result. On the real board it was built for, the Bluetooth OBD-II dongle's 4-layer KiCad board, routing fell from 16 to 38 minutes to about 11 to 17 seconds. The test suite checks the C router against the original Python router on thousands of random searches across 500 random boards and reports zero cost or path mismatches.
Visual Gridrouter, the macOS app in viewer/, replays a recorded routing run search by search: wavefronts, committed copper, rip-ups and failed pads, with a timeline and a nets table. It only watches trace files and never steers the router. The viewer runs on macOS 14 or later on Apple Silicon; Windows and Linux clients are planned on the same portable C++ core and have not been built.
Alternatives
Compare side by side- TraceMaker
TraceMaker is a standalone autorouter and placer that takes a .kicad_pcb file and writes tracks and vias back into it, while hw-gridrouter is a library for Python scripts that generate KiCad boards, returning segment and via lists for the script to emit.
- tscircuit-autorouter
tscircuit-autorouter routes boards inside the tscircuit stack, while hw-gridrouter is a standalone grid router library for Python scripts that generate KiCad boards, with a macOS viewer for replaying a routing run.
Recurring errors it addresses
Error Index entries this tool is built to reduce or work around.
- Interactive routing creates unwanted micro-segments and awkward paths that take time to clean up.Error Index
- When kct route fails its post-route short check, it still prints Status: SUCCESS on an earlier summary line and the ROUTING FAILED banner only comes after. The exit code is correct (3), but an agent or person reading only the first status line sees SUCCESS for a board that shorts two nets, contradicting the tool's own contract that SUCCESS must be unreachable while the written board shorts.Error Index
- Freerouting can insert a complete new route, delete it as a dangling tail before the final endpoint attaches, and still return ROUTED while the connection is missing: on the C4 net of the Corney Island wireless board the maze found a valid 150 um bridge, stub cleanup deleted the whole bridge, the later attachment added only a tiny stub, and KiCad confirms C4 is still disconnected.Error Index
Sources
Not verified
- pricing (no pricing stated; open source tool)
Last verified November 24, 2026. Listings are informational. The evidence score measures public, verifiable evidence and is not an endorsement or a compatibility claim.