feat: add minimum drill diameter DRC check - #194
Open
zkasuran wants to merge 1 commit into
Open
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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'smin_via_hole_diameterwhen 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_diameterwas referenced by zero checks and a too-small drill passed DRC clean.DEFAULT_VIA_DIAMETERindrc-defaults.tsexists 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:After, the same board reports both holes:
How
checkMinDrillDiametercollects every round drilled hole (pcb_via,pcb_plated_holewithshape: "circle",pcb_holewithhole_shape: "circle") and itshole_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 intorunAllPlacementChecksnext tocheckViasOffBoardand exported fromindex.ts. It emits apcb_placement_errorthe same waycheckViasOffBoardandcheckPadsOffBoarddo.Tests
tests/lib/check-min-drill-diameter.test.tscovers 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 boardmin_via_hole_diameteroverride that raises the threshold, therunAllChecksintegration that shows the fixed false negative plus the SVG snapshot rendered withshouldDrawErrors: true.Verified locally
bun test tests/lib/check-min-drill-diameter.test.ts: 10 pass, 0 failbun 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: cleanbun run format:check: cleanbun run build: successbunx @tscircuit/dependency-check: all passedAI 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.