Skip to content

fix: size hand-placed vias from the board's via minimums - #4796

Open
amartya1523 wants to merge 2 commits into
tscircuit:mainfrom
amartya1523:hand-placed-vias-board-minimums
Open

amartya1523 wants to merge 2 commits into
tscircuit:mainfrom
amartya1523:hand-placed-vias-board-minimums

Conversation

@amartya1523

Copy link
Copy Markdown

Fixes item 1 of tscircuit/tscircuit#5559.

Problem

Autorouted vias and via-stitching vias already use the board's min_via_hole_diameter and min_via_pad_diameter. Hand-placed vias did not, and always used the 0.2/0.3mm defaults. On a board declaring minViaHoleDiameter={0.3} minViaPadDiameter={0.6}, every one of these came out 0.2/0.3mm, a 0.05mm ring that JLCDFM flags as Danger:

  • pcbPath / pcbPaths vias
  • <pcbtrace> route vias without a size
  • <via> with no holeDiameter / outerDiameter
  • vias from trace-level routing

A board that mixes autorouted and hand-routed nets therefore ended up with two via sizes.

Changes

  • I moved the via-minimum resolution that Board writes onto pcb_board into Board._getResolvedMinViaDiameters(). The order is unchanged: minViaHoleDiameter/minViaPadDiameter, then the board's pcbStyle via size, then JLCPCB's minimums, with the pad derived from the hole when only the hole minimum is given.
  • getViaDiameterDefaultsForComponent(component, overrides) is now used by <via>, <pcbtrace>, pcbPath/pcbPaths (both manual-trace render paths) and trace-level routing. The precedence is:
    1. an explicit size (<via> props, or route-point hole_diameter/outer_diameter)
    2. the inherited pcbStyle via size, so a group-level style still wins
    3. the board's resolved via minimums
    4. the 0.2/0.3mm defaults
  • Boards without via minimums resolve to JLCPCB's 0.2/0.3mm, the same as the old defaults, so existing designs don't change.

Tests

One test per file, each with a PCB snapshot labelled by pcbnotetext:

  • repro5559-hand-placed-vias-board-minimums: pcbPath, <pcbtrace> and <via> on a 0.3/0.6 board. This fails on main with all four vias at 0.2/0.3 and passes with this change.
  • via-board-minimum-diameters1: explicit, pcbStyle and route-point sizes still win over the board minimums.
  • via-board-minimum-diameters2: with only minViaHoleDiameter, vias match pcb_board.min_via_* (0.3/0.45).
  • via-board-minimum-diameters3: a board without minimums keeps 0.2/0.3.

I also ran every test file that touches <via>, pcbPath, <pcbtrace> or via sizes (99 files). Their failures are identical to main on the same machine: pre-existing macOS-vs-CI snapshot render differences, and none are new. tsc --noEmit is clean.

The snapshots were generated on macOS. If CI renders them differently, /update-snapshots should refresh them.

Related @tscircuit/checks PRs for the DFM checks in the same issue: tscircuit/checks#452 (via sizes / annular rings) and tscircuit/checks#453 (trace width).

pcbPath/pcbPaths vias, <pcbtrace> route vias, <via> without a size and
trace-level routed vias used the 0.2/0.3mm defaults even when the board
declared minViaHoleDiameter/minViaPadDiameter, while autorouted and stitching
vias already used the board minimums. All of them now share
Board._getResolvedMinViaDiameters(), the same values recorded on pcb_board.
Explicit sizes and pcbStyle via sizes still take precedence, and boards
without via minimums keep the existing defaults.

Fixes tscircuit/tscircuit#5559 (item 1).
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
tscircuit-core-benchmarks Ready Ready Preview Oct 27, 2026 5:25am UTC

Request Review

@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

This branch was successfully deployed

1 active deployment
Preview — 9bbacd05 Deployed Oct 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant