Skip to content

solderjumper without a pin count emits NaN geometry #784

Description

@zkasuran

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions