Route geometry: off-45° segments, right-angle corners and wiggles reach finish unchecked

noah · ·edited ·closed by Colby Knox

Route geometry: off-45° segments, right-angle corners and wiggles reach finish unchecked

Seen on: adom-aiflow 0.2.40 to 0.2.44, the same AM32 ESC built twice (2 layers, about 40 × 40 mm molecule):

  • AI Flow: adom/am32-esc-2s6s-molecule, a full AI Flow run, board of record board-19, delivered 2026-11-03.
  • Hands-on: adom/am32-esc-v1, placed and routed by hand in KiCad by Noah (2026-11-02).

Both pages are private to the adom org.

What happened: the AI Flow board passed gate and finish (DRC clean, 100 % routed). Its traces still look wrong to a layout engineer. They run at odd angles, turn at right angles and wiggle in short sideways steps. A script read both .kicad_pcb files with pcbnew 10.0.6; the script is attached as route_fig.py.txt:

AI Flow Hands-on
Track segments / total length 941 / 1098 mm 442 / 579 mm
Segments off a multiple of 45° (by more than 1°) 151 (117 mm, 10.7 % of the length) 0
90° corners (two segments of one net, one layer) 66 6
Direction reversals within 1 mm (jogs, wiggles) 250 41

Where the bad copper came from (each segment matched to the plan that drew it):

  • The AI's own hand-written plan for the power copper and gate drive (power_route.py, landed with take route=ai): 74 off-angle segments (95 mm) and 44 of the 90° corners.
  • AI Flow's grid router (route --variants 8 --passes 9, plus a second pass): 77 off-angle segments (22 mm). They are mostly short entries into off-grid pads, about 0.3 mm on average. The router also drew 22 of the 90° corners.

So two things are wrong. The router itself leaves off-angle pad entries and right-angle turns, and gate judges only DRC. Copper written by the AI (or by Freerouting, or anything given to gate --plan) is never held to a geometry standard at all.

Why it matters: slow signals on a modern fab still work with this copper. But it is not how a board should be drawn. It is harder to review, odd angles and wiggles add length and coupling, and a human picking up the board has to redo it. The rule a layout engineer follows:

  • Traces run at 0, 45, 90, 135, 180, 225, 270 or 315° only.
  • Right-angle corners are a last resort, for a slow signal in a very tight spot.
  • No zig-zags.

The hands-on board meets the rule with 0 off-angle segments, and its 6 right angles are trace-into-via joins.

Suggested fix:

  1. A route-geometry check in gate (and in the route report and finish) that runs on every plan whoever wrote it. It counts:

    • off-45° segments (excluding the arc of a deliberate curve, if any are ever planned)
    • 90° corners and acute corners
    • direction reversals shorter than N × width

    Each count names the net, with coordinates. It warns by default. It is an error on the nets the spec ranks highest (#129), and when spec.routeStyle: "strict" is set.

  2. Router: enter an off-grid pad along the pad's own axis, then take the 45° jog onto the grid. Never draw the diagonal straight to the pad centre. Extend simplify.rs to chamfer 90° turns into two 45° turns where the clearance allows, and to merge wiggles (alternating turns within a few track widths) into one straight run.

  3. Timeline: show the geometry counts beside DRC in the routing step, so the human sees them before finish.

The attached route_fig.py gives the metric definitions and the drawing below. Legend: red = off-45° segment, yellow ring = 90° corner, cyan × = short reversal, white dot = signal via. Left is AI Flow, right is hands-on.

fig_compare

crop_logic

route_fig.py.txt

Related: #128 (vias and detours), #129 (signal priority), #130 (placement priorities).

3 Replies

noah mentioned this in pull request #59 ·
John Lauer ·

Noah, thanks for the numbers and for route_fig.py; it made this easy to check. Fixed in adom-aiflow 0.2.49, in two parts.

1. A route-quality report. route, gate and finish now count, with the same thresholds as route_fig.py:

  • off-45° segments (count and length);
  • 90° corners;
  • acute corners;
  • wiggles (a segment of 1 mm or less with opposite turns at its ends).

Each finding has an x, y and layer. The full report goes to plan-route-quality.json, route-quality.json and finish-route-quality.json, and finish lists it on its report card. On buck-12v5v-molecule board-6 it gives 34 off-45° segments (12.6 mm), 15 right angles, 4 acute corners and 31 wiggles. route_fig.py's own metrics() gives the same 34 / 12.58 mm / 15 / 31.

2. The router smooths what it can. After the staircase clean-up, the plan simplifier turns a sideways step of 1 mm or less into a single 45° step, and cuts other right-angle corners into two 45s. It does this only where its own clearance check passes, and it never moves pads, layer changes or impedance pairs. On the buck board, right angles went from 17 to 9 with the same vias. KiCad DRC is 0 errors and 0 unconnected, both with and without the change.

One change from your proposal: the report is findings and suggestions, never an error. AI Flow is a suggestion engine now; it never refuses (0.2.48). The AI sees the counts and decides with the human.

Still open, so I'm keeping this issue open:

  • Most of the wiggles on that board are not the simple perpendicular step, and they are unchanged (83 before and after).
  • Entering off-grid pads along the pad's own axis (your fix 2) is not done.

Upgrade: tell your AI "give me the latest adom-aiflow" (or adom-wiki pkg install adom/adom-aiflow); adom-aiflow --version says 0.2.49.

Colby Knox marked this in progress ·
Colby Knox mentioned this in pull request #67 ·
Colby Knox ·

Noah, more of this is in adom-aiflow 0.2.52. The router now does the following:

  • Charges more for a right angle than for the two 45s that replace it.
  • Gives an off-angle segment a straight leg and a 45 where it's clear to.
  • Pulls short detours tight, without adding a hard corner.
  • Keeps the points where another path or pad joins the net fixed. The older corner clean-up could move those and break a connection.

Before and after, with copper stripped and route alone. "Buck, Altium copy" means the buck molecule's Altium board:

Board Off-45° 90° corners Wiggles Vias Copper (mm) Connections left open
Buck, Altium copy 30 → 0 8 → 9 24 → 9 15 → 15 220 → 217 0 → 0
Buck molecule 33 → 1 3 → 3 26 → 9 25 → 23 314 → 260 0 → 0
ESC 165 → 9 88 → 49 1321 → 127 365 → 375 2492 → 2339 5 → 3
pic_programmer 59 → 0 8 → 10 27 → 20 20 → 20 1897 → 1898 1 → 1
StickHub 92 → 12 51 → 31 175 → 70 23 → 30 325 → 403 70 → 80

Where it isn't simply better:

  • StickHub was routed with no planes declared. It reports more connections open, though DRC finds fewer unconnected (98 → 83).
  • ESC and StickHub gained vias, and pic_programmer gained two right angles.
  • gate passed on the Altium copy of the buck, where it found one unconnected before. The other buck run stopped on its molecule check before and after, so that one has no DRC comparison.

Still open:

  • I haven't run it on your AM32 board, so your numbers aren't confirmed yet. A run there is the real test.
  • A pad's own axis is only preferred, not guaranteed.
  • Some wiggles remain.

Upgrade: tell your AI "give me the latest adom-aiflow" (or adom-wiki pkg install adom/adom-aiflow); adom-aiflow --version says 0.2.52.

Colby Knox removed the in progress marker ·
Colby Knox marked this in progress ·
Colby Knox removed the in progress marker ·
Colby Knox marked this in progress ·
Colby Knox linked pull request #90, which closes this when it merges ·
Colby Knox closed this in pull request #90 ·
Colby Knox ·

Noah, the two items still open here are in AI Flow 0.2.71.

  • Pads entered along their own axis. When a route leaves a pad at an odd angle, the router now rebuilds that end. It runs a straight stub out along the pad's axis (a long pad's long axis, either axis of a square pad, any 45 of a round pad, never back into its own part), then one 45 to the route. It does this only where it clears, adds no hard corner or wiggle, and is at most 0.5 mm longer. The stub is then kept as it is.
  • The remaining wiggles. Most of the ones left weren't the simple step but a short leg between two opposite 45s: a lane change, or a zigzag. A new pass slides that leg along until it merges with its neighbour, at the same length, where it clears.

With copper stripped and route alone, from 0.2.70 to 0.2.71:

Board Wiggles 90° corners Pads entered on axis Vias, open, DRC
ESC 127 → 118 49 → 46 50 % → 58 % unchanged
StickHub 73 → 60 30 → 30 53 % → 55 % unchanged
pic_programmer 20 → 19 10 → 10 43 % → 44 % unchanged
Buck molecule 9 → 9 3 → 3 31 % → 39 % unchanged

Honestly, these are moderate gains, not a hand layout. What's left is mostly parts rotated off every 45 (no on-axis 45 entry exists), pads with no room before a join or via, jogs whose only fix is a 90° turn, and two paths meeting on one pad. I haven't run your AM32 board. If its numbers are still far from your hand-routed one, reopen this with them and I'll take the next pass from there.

Upgrade with adom-wiki pkg install adom/adom-aiflow; adom-aiflow --version then shows 0.2.71.

Log in to reply.