Skip to content

fix(export): emit drill files for every plated via layer span in gerbers export - #4354

Open
creationsunitassistant wants to merge 3 commits into
tscircuit:mainfrom
creationsunitassistant:fix/gerbers-multilayer-via-drill-spans
Open

fix(export): emit drill files for every plated via layer span in gerbers export#4354
creationsunitassistant wants to merge 3 commits into
tscircuit:mainfrom
creationsunitassistant:fix/gerbers-multilayer-via-drill-spans

Conversation

@creationsunitassistant

Copy link
Copy Markdown

Summary

Fixes #4346

tsci export --format gerbers called convertSoupToExcellonDrillCommands once without layer_span, so the converter selected only the default F.Cu–B.Cu span. Every pcb_via whose span is not top-to-bottom was silently omitted from the drill files — the export exits successfully with no warning, producing fabrication files with open circuits.

Fix

Enumerate all distinct plated layer spans present in the circuit JSON (from pcb_via / pcb_plated_hole from_layer/to_layer) and emit one drill file per span:

  • drill.drl — unchanged, default top-to-bottom span
  • drill_top__inner1.drl, drill_inner1__bottom.drl, etc. — one per non-default span

Verification

  • Reproduced the bug first: 4-layer board with 3 vias (top-bottom, top-inner1, inner1-bottom) exported only 1 drill hit; the two blind/buried vias were dropped.
  • After fix: 3 drill hits across 3 span files.
  • New regression test: tests/cli/export/export-gerbers-multi-span-drills.test.ts (passes)
  • bun x tsc --noEmit -p tsconfig.json clean
  • Existing export tests unaffected

Notes

  • Uses the existing layer_span option already supported by circuit-json-to-gerber — no library changes needed.
  • Fabricators treat multiple PTH files with distinct TF.FileFunction spans as standard (matches KiCad's per-span drill output).

🤖 This PR was prepared with AI assistance (Claude via Hermes agent). Happy to adjust.

…ers export

Previously the gerbers export called convertSoupToExcellonDrillCommands once
without layer_span, so only the default top-to-bottom span vias were emitted.
Every non-default-span via (e.g. F.Cu-In1, In1-B.Cu on 4-layer boards) was
silently omitted from the drill files, producing fabrication files with open
circuits.

Now the export enumerates all distinct plated spans present in the circuit
JSON and emits one drill file per span (drill.drl keeps the default
top-bottom span; drill_<span>.drl for each non-default span).

Fixes tscircuit#4346

Co-authored-by: Claude (Anthropic) <noreply@anthropic.com>
@creationsunitassistant

Copy link
Copy Markdown
Author

Hi! I reproduced this on a 4-layer fixture (3 vias: F.Cu–B.Cu, F.Cu–In1, In1–B.Cu — the same span mix from your repro table) and confirmed only the through vias made it into drill.drl. Fix emits one drill file per span using the converter's existing layer_span option.

If there's a bounty attached to this issue, happy to claim it properly — first PR to this repo, aiming to become a regular contributor.

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.

Gerber ZIP export silently omits non-through via drill spans on multilayer boards

1 participant