fix(pad): default w and h to 1mm so a bare pad renders (#788) - #789
Open
zkasuran wants to merge 1 commit into
Open
fix(pad): default w and h to 1mm so a bare pad renders (#788)#789zkasuran wants to merge 1 commit into
zkasuran wants to merge 1 commit into
Conversation
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.
Closes #788
padis advertised bygetFootprintNames(), butfp.string("pad").circuitJson()throws a rawTypeErrorbecausepad_defdeclareswandhwith no defaults andpad()passes them tomm()without parsing. A missing dimension reaches@tscircuit/mmasundefined, so it throwsundefined is not an object (evaluating 'n.replace'). The siblingsmtpaddefaults to a 1mm pad in the same situation, sosmtpadrenders from a bare name whilepadcrashes.Repro
The change
Give
pad_defa 1mm default forwandh(the same fallbacksmtpaduses) and parse the params throughpad_definsidepad()so the defaults apply, matching howsmtpadcallssmtpad_def.parse. A barepadnow renders a 1mm square pad. Explicit dimensions still override, sofp().pad().w(2).h(1)is unchanged.Verification
tests/pad_bare.test.tsrendersfp.string("pad")to a PCB SVG snapshot and asserts a single 1mm pad.tests/pad.test.ts(sizedw2 h1andw3 h2) still passes unchanged.padis a generic single SMD pad, not a named KiCad library footprint, so there is no reference to compare against. The parity harness fetches named KiCad footprints (for examplePackage_SON.pretty/VSON-8-1EP...), which a generic pad has no equivalent of.bun run buildclean,biome formatclean.Disclosure
AI assistance (Claude, Anthropic) was used in developing this change. The design, review and verification were done by the author. Verified locally before submitting: the full
bun testsuite (522 pass),bun run buildandbiome format.