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.

Open projectLibrary / CLIOpen sourceActiveElectronics & PCB

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.

  • 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.

Sources

  1. 1GitHub repo and READMEgithub.com

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.