Skip to content

fix: preserve terminals on multi-pin switch imports - #541

Open
GokulPandi-M wants to merge 6 commits into
tscircuit:mainfrom
GokulPandi-M:fix/preserve-multi-terminal-switch-pins
Open

fix: preserve terminals on multi-pin switch imports#541
GokulPandi-M wants to merge 6 commits into
tscircuit:mainfrom
GokulPandi-M:fix/preserve-multi-terminal-switch-pins

Conversation

@GokulPandi-M

@GokulPandi-M GokulPandi-M commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Motivation

While using C2941005 on a real board, I found that the converter treated the six-terminal slide switch as a two-terminal SPST switch. This removed pins 3–6 from the schematic. Repro: #538.

Change

  • Use the native switch primitive only for two-terminal switches.
  • Preserve the imported EasyEDA symbol and every terminal for multi-terminal switches.
  • Add the component reference through the existing {REF} placeholder, so names such as SW1 and SW2 are generated dynamically.

The converter intentionally does not infer SPDT/DPDT topology from pin count alone. For C2941005, the manufacturer drawing uses pins 2 and 5 as the common terminals, while the built-in DPDT symbol uses a different pin topology. Keeping the imported symbol avoids silently changing electrical meaning.

References: JLCPCB C2941005

Ref:

Screenshot 2026-09-05 at 12 36 34 PM
Before After
Two-terminal SPST import Imported six-terminal symbol with reference

Verification

  • C2941005 keeps schematic terminals 1–6 and their PCB pad mappings.
  • C136720 keeps its five-terminal imported symbol.
  • Updated schematic snapshots verify the visible reference.
  • Typecheck and formatting pass.
  • Full test suite: 210 passed, 0 failed.

This PR does not change PCB, 3D-model handling, or add native switch simulation semantics for multi-terminal imports.

@GokulPandi-M
GokulPandi-M marked this pull request as ready for review September 4, 2026 11:17

@techmannih techmannih left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont forgot to add reference?

Comment thread lib/websafe/convert-to-typescript-component/index.tsx
@GokulPandi-M
GokulPandi-M marked this pull request as draft September 5, 2026 07:24
@GokulPandi-M GokulPandi-M changed the title fix: preserve schematic terminals on multi-pin switches fix: preserve terminals on multi-pin switch imports Sep 5, 2026
@GokulPandi-M
GokulPandi-M marked this pull request as ready for review September 5, 2026 15:45
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.

2 participants