Skip to content

feat: add minimum drill diameter DRC check - #194

Open
zkasuran wants to merge 1 commit into
tscircuit:mainfrom
zkasuran:fix/min-drill-diameter-drc
Open

feat: add minimum drill diameter DRC check#194
zkasuran wants to merge 1 commit into
tscircuit:mainfrom
zkasuran:fix/min-drill-diameter-drc

Conversation

@zkasuran

Copy link
Copy Markdown

What

Adds checkMinDrillDiameter, a placement DRC check that flags any round drilled hole whose drill diameter is below the fab minimum. It covers vias, circular plated holes and circular unplated holes. The threshold is the board's min_via_hole_diameter when set, otherwise the JLCPCB default of 0.2mm from @tscircuit/jlcpcb-manufacturing-specs.

Refs #15 (Drill Diameter Min).

Why

The fab drills holes with a physical bit, so a hole smaller than the smallest bit cannot be made. Every existing check reads a clearance or a position, so min_via_hole_diameter was referenced by zero checks and a too-small drill passed DRC clean. DEFAULT_VIA_DIAMETER in drc-defaults.ts exists for this but was never used.

Before this change a board with a 0.1mm via drill and a 0.1mm plated-hole drill returns no errors from runAllChecks:

total errors from runAllChecks: 0

After, the same board reports both holes:

Drill diameter of ... is 0.1mm, below the minimum drill diameter of 0.2mm

How

checkMinDrillDiameter collects every round drilled hole (pcb_via, pcb_plated_hole with shape: "circle", pcb_hole with hole_shape: "circle") and its hole_diameter, then flags any whose diameter is under the minimum. Oval and pill holes are milled slots rather than drilled, so they are left to a separate slot rule. It is wired into runAllPlacementChecks next to checkViasOffBoard and exported from index.ts. It emits a pcb_placement_error the same way checkViasOffBoard and checkPadsOffBoard do.

Tests

tests/lib/check-min-drill-diameter.test.ts covers no holes, a via above the minimum, a via exactly at the minimum, a via below it, a circular plated hole below it, an unplated circular hole below it, an oval plated hole left untouched, a board min_via_hole_diameter override that raises the threshold, the runAllChecks integration that shows the fixed false negative plus the SVG snapshot rendered with shouldDrawErrors: true.

Verified locally

  • bun test tests/lib/check-min-drill-diameter.test.ts: 10 pass, 0 fail
  • bun test (full): 151 pass, 1 fail. The one failure is pre-existing on main (checkEachPcbTraceNonOverlapping > reports a trace overlapping a rotated pill plated hole) and is unrelated to this change.
  • bunx tsc --noEmit: clean
  • bun run format:check: clean
  • bun run build: success
  • bunx @tscircuit/dependency-check: all passed

AI assistance (Claude) was used in developing this change. The design, review and verification were done by the author. Verified locally before submitting: bun test on the new file (10 pass) and the full suite (151 pass, 1 pre-existing unrelated fail), bunx tsc --noEmit, bun run format:check, bun run build and bunx @tscircuit/dependency-check.

Vias and circular plated or unplated holes with a drill below the fab
minimum passed runAllChecks. Every existing check reads a clearance or a
position, so a hole that is simply too small to drill was never flagged.

checkMinDrillDiameter flags any round drilled hole whose diameter is under
min_via_hole_diameter (0.2mm by default, board value when set). Milled oval
and pill holes are excluded because they are cut, not drilled.

Refs tscircuit#15 (Drill Diameter Min).
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