Skip to content

Add pcbComb: fixed straight→45°→straight comb routing for pin-line bundles#2567

Open
derekbreden wants to merge 1 commit into
tscircuit:mainfrom
derekbreden:pcbComb
Open

Add pcbComb: fixed straight→45°→straight comb routing for pin-line bundles#2567
derekbreden wants to merge 1 commit into
tscircuit:mainfrom
derekbreden:pcbComb

Conversation

@derekbreden

@derekbreden derekbreden commented Jul 3, 2026

Copy link
Copy Markdown

Adds pcbComb, a <trace> prop in the same family as the existing pcbStraightLine and pcbPath — a fixed, manually-shaped route rather than an autorouted one. Where pcbStraightLine draws a direct line, pcbComb draws the other common hand-routed shape between two lines of pads: a perpendicular escape off the pad, one 45° diagonal, and a perpendicular landing. N of them nest into an even comb.

<trace from=".U1 > .p1" to=".U2 > .q8" pcbComb="rowToColumn" />

The value is <sourceLine>To<targetLine>: columnToColumn | rowToColumn | columnToRow | rowToRow (a COLUMN of pads escapes perpendicular in x, a ROW in y). The two bend points are derived from the pads' live global positions in the manual-trace phase, before autorouting — so the comb re-derives if a part moves, nothing frozen. A comb whose fixed shape can't reach its target without backtracking is left unrouted for the autorouter.

Where it helps — and where we're unsure

We hit this on a denser real board and wanted to offer a distilled, deliberately contrived example rather than imply it's common. The same 12-net row→column bundle, routed three ways on the identical board:

approach result
autorouter 14 vias, a 23-segment zigzag, nets pushed onto both layers
pcbStraightLine shorts a land — the diagonal clips the neighbour land's rectangle
pcbComb 12 even miters, one layer, no vias

autorouter
autorouter

pcbStraightLine
pcbStraightLine

pcbComb
pcbComb

To be clear about what this isn't: the autorouter isn't wrong — it optimizes each net with no signal to keep a bundle uniform, and just gets erratic under congestion (a 10 mm change in the gap flips it between 0 and 14 vias). For a plain fan-out it ties pcbComb; the corner turn is where a declared shape earns its keep. And we honestly don't know whether this case is common, whether we're doing something else that creates our need, or whether bundle-shaping is a direction tscircuit wants to own vs. leave to the autorouter. We're offering it, not arguing for it.

The change

  • lib/utils/computeCombWaypoints.ts — pure geometry (the two bend points).
  • A branch in Trace_doInitialPcbManualTraceRender mirroring the existing pcbStraightLine branch, plus a matching skip in Trace_doInitialPcbTraceRender. No autorouter changes.
  • A snapshot test for the comb. docs/pcb-comb/ is only the illustration above — happy to drop it.

On the red CI: both the type-check and test failures here are only the props dependency — <trace pcbComb="…"> isn't in the upstream traceProps yet (the type and the runtime zod schema), so type-check rejects the prop and the test's trace autoroutes instead of combing. Both clear once tscircuit/props#715 publishes; nothing else is failing (the other test shards are just fail-fast cancellations).

@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tscircuit-core-benchmarks Ready Ready Preview, Comment Jul 3, 2026 5:30am

Request Review

…ndles

A sibling to pcbStraightLine/pcbPath. A <trace pcbComb="rowToColumn"> (also
columnToColumn | columnToRow | rowToRow) is drawn as a fixed manual route
between two lines of pads: a perpendicular escape, one 45° diagonal, a
perpendicular landing. computeCombWaypoints derives the two bend points from
the pads' live global positions in the manual-trace phase, before autorouting —
so N of them nest into an even comb and re-derive if a part moves. A comb whose
fixed shape can't reach the target without backtracking is left for the autorouter.

Reads the pcbComb enum from @tscircuit/props (companion PR).

docs/pcb-comb/ shows the same 12-net row→column bundle three ways (illustration
for the PR discussion, not a test).
derekbreden added a commit to derekbreden/core that referenced this pull request Jul 4, 2026
The workbench branch carried this feature under its pre-PR name (pcbFan /
computeFanWaypoints). The extracted PR names it pcbComb / computeCombWaypoints.
Rename here so the board dogfoods the exact upstreamed API; the util is adopted
from the PR verbatim (same algorithm, polished comments).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
derekbreden added a commit to derekbreden/homesodamachine that referenced this pull request Jul 4, 2026
The board and forks carried this feature under its pre-PR name pcbFan; the
extracted PRs name it pcbComb (tscircuit/core#2567, tscircuit/props#715). Rename
the core+props forks to pcbComb — adopting the PRs' exact util and prop verbatim
(same algorithm, only names/comments differ) — bump the override SHAs, and switch
every pcba.tsx trace plus the docs to pcbComb. Pure rename: the rendered copper is
byte-identical, so out/ is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant