Summary
fp.string("solderjumper") with no pin count silently emits invalid geometry instead of a real footprint. solderjumper2 and solderjumper3 are fine.
Reproduction
import { fp } from "@tscircuit/footprinter"
const circuitJson = fp.string("solderjumper").circuitJson()
console.log(circuitJson.find((e) => e.type === "pcb_courtyard_rect"))
console.log(circuitJson.find((e) => e.type === "pcb_silkscreen_text"))
Output at v0.0.417:
- 0 pads
pcb_courtyard_rect with width: NaN and center.x: NaN
pcb_silkscreen_text with anchor_position.x: NaN
fp.string("solderjumper2") and fp.string("solderjumper3") return 2 and 3 pads with finite geometry.
Cause
In src/fn/solderjumper.ts, num_pins is read from params with no default. A bare solderjumper string parses to num_pins: undefined, so (num_pins - 1) * padSpacing and every value derived from it (outline, courtyard, silkscreen anchor) become NaN.
Expected
A bare solderjumper should render a real footprint. Most footprints that take a pin count default a sensible one when it is omitted (dip, ssop, pinrow and many others). A couple throw a clear error instead (jst). Either is fine. Emitting NaN is not.
Summary
fp.string("solderjumper")with no pin count silently emits invalid geometry instead of a real footprint.solderjumper2andsolderjumper3are fine.Reproduction
Output at v0.0.417:
pcb_courtyard_rectwithwidth: NaNandcenter.x: NaNpcb_silkscreen_textwithanchor_position.x: NaNfp.string("solderjumper2")andfp.string("solderjumper3")return 2 and 3 pads with finite geometry.Cause
In
src/fn/solderjumper.ts,num_pinsis read from params with no default. A baresolderjumperstring parses tonum_pins: undefined, so(num_pins - 1) * padSpacingand every value derived from it (outline, courtyard, silkscreen anchor) become NaN.Expected
A bare
solderjumpershould render a real footprint. Most footprints that take a pin count default a sensible one when it is omitted (dip,ssop,pinrowand many others). A couple throw a clear error instead (jst). Either is fine. Emitting NaN is not.