Skip to content

fix: bind converted KiCad reference text to the instance name - #4710

Open
billythompsons wants to merge 3 commits into
tscircuit:mainfrom
billythompsons:fix-4708-convert-ref-placeholder
Open

fix: bind converted KiCad reference text to the instance name#4710
billythompsons wants to merge 3 commits into
tscircuit:mainfrom
billythompsons:fix-4708-convert-ref-placeholder

Conversation

@billythompsons

Copy link
Copy Markdown

Fixes #4708.

Problem

tsci convert copies the KiCad fp_text reference placeholder into a literal text="REF**", so every placed instance of the converted footprint prints "REF**" instead of its reference designator.

Fix

After convertCircuitJsonToTscircuit runs, the KiCad reference placeholder (text="REF**" on a silkscreentext) is rebound to the component instance: text={props.name ?? "REF**"}. Ordinary user text stays literal, and the rewrite only applies when the generated component has props in scope.

Kept this in the CLI's convert path since the placeholder is a KiCad artifact known at conversion time; happy to move it into circuit-json-to-tscircuit if you'd rather handle it there.

Tests

  • convert-kicad-mod-reference-text.test.ts: converts the issue's two-pad .kicad_mod plus an fp_text user control - asserts the reference placeholder is rebound and user text stays literal.
  • convert-kicad-mod-reference-e2e.test.ts: builds a board with two instances (U1, U2) and asserts the emitted pcb_silkscreen_text values are exactly ["U1", "U2"] (the issue's failing scenario).

Full tests/cli/convert suite passes.

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.

tsci convert hardcodes KiCad reference placeholder REF** in reusable TSX footprints

1 participant