Ryan Malloy 992bba82a0 Add multi-layer routing with vias
Extends the grid router with a layer axis: A* nodes are (col, row, layer),
in-plane moves stay on a layer, and a via move transitions between layers
at a cell for a configurable via_cost (so the router prefers one layer but
changes layers to get through). Occupancy is tracked per (cell, layer);
a through via must be clear on every signal layer and then blocks all of
them for other nets.

RouteResult now carries per-layer wire segments and per-net via locations.
The pipeline emits each segment on its layer and each via as
(via <padstack> x y), using the DSN's via padstack; wire and via
coordinates are converted from board units back to DSN units. route() and
route_dsn_board() take an optional layers= to restrict routing (e.g. a
single layer) for comparison.
2026-07-12 13:20:52 -06:00

freeroute

A native Python PCB autorouter — a Java-free port of the FreeRouting engine.

Why

kicad-mcp currently autoroutes by shelling out to freerouting.jar, which drags in a JVM dependency. freeroute reimplements the routing engine in pure Python so the toolchain needs no Java at all.

The contract

The entire integration surface is two Specctra files:

board.dsn  ──▶  freeroute  ──▶  board.ses
(unrouted)                       (routed session: traces + vias)

kicad-cli already exports .dsn and imports .ses, so freeroute is a drop-in replacement for the JAR step — nothing else in the pipeline changes.

Status

Pre-alpha. Under active development. See docs/PORTING_PLAN.md for the architecture and porting roadmap.

Usage (target)

freeroute board.dsn -o board.ses

Development

uv sync
uv run pytest
uv run ruff check src/ tests/

License

GPL-3.0-or-later, matching the FreeRouting source it is ported from.

Description
Native Python PCB autorouter — a Java-free port of the FreeRouting engine (Specctra DSN in, SES out)
Readme GPL-3.0 391 KiB
Languages
Python 100%