Skip to content

feat: implement TO-220 horizontal variant footprint (to220h)#533

Open
victorjzq wants to merge 4 commits intotscircuit:mainfrom
victorjzq:feat/to220h-185
Open

feat: implement TO-220 horizontal variant footprint (to220h)#533
victorjzq wants to merge 4 commits intotscircuit:mainfrom
victorjzq:feat/to220h-185

Conversation

@victorjzq
Copy link
Contributor

Summary

Implements the TO-220 horizontal variant footprint as requested in #185.

  • New to220h footprint for TO-220 packages mounted horizontally (flat against PCB)
  • Supports tabdown (default) and tabup orientations
  • KiCad-compatible: 2.54mm pitch, rectangular pad on pin1, pill pads on pins 2/3
  • Aliases: TO-220-3_Horizontal_TabDownto220h_3, TO-220-3_Horizontal_TabUpto220h_3_tabup

Usage

fp.string("to220h_3")            // 3-pin, tab pointing down (default)
fp.string("to220h_3_tabup")      // 3-pin, tab pointing up
fp.string("TO-220-3_Horizontal_TabDown")  // KiCad alias
fp.string("TO-220-3_Horizontal_TabUp")    // KiCad alias

Tests

  • tests/to220h.test.ts: SVG snapshot tests for TabDown, TabUp, and both aliases
  • tests/kicad-parity/to220h_3_kicad_parity.test.ts: KiCad parity tests comparing against Package_TO_SOT_THT.pretty/TO-220-3_Horizontal_TabDown.circuit.json and TO-220-3_Horizontal_TabUp.circuit.json
  • All 387 tests pass

/claim #185
Fixes #185

victorjzq added 2 commits March 19, 2026 18:36
Add to220h footprint supporting horizontal TO-220 packages mounted flat
against the PCB. Supports TabDown (default) and TabUp orientations via
the tabup/tabdown parameter flags.

- to220h_3: default 3-pin horizontal, tab pointing down
- to220h_3_tabup: 3-pin horizontal, tab pointing up
- Aliases: TO-220-3_Horizontal_TabDown, TO-220-3_Horizontal_TabUp
- KiCad parity tests for both TabDown and TabUp variants
- Holes match to220f: 2.54mm pitch, rect pad on pin1, pill pads on others

Fixes tscircuit#185
Comment on lines +5 to +37
test("parity/to220h_3 (TabDown)", async () => {
const { combinedFootprintElements, booleanDifferenceSvg } =
await compareFootprinterVsKicad(
"to220h_3",
"Package_TO_SOT_THT.pretty/TO-220-3_Horizontal_TabDown.circuit.json",
)

const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements, {
showCourtyards: true,
})
expect(svgContent).toMatchSvgSnapshot(import.meta.path, "to220h_3")
expect(booleanDifferenceSvg).toMatchSvgSnapshot(
import.meta.path,
"to220h_3_boolean_difference",
)
})

test("parity/to220h_3_tabup (TabUp)", async () => {
const { combinedFootprintElements, booleanDifferenceSvg } =
await compareFootprinterVsKicad(
"to220h_3_tabup",
"Package_TO_SOT_THT.pretty/TO-220-3_Horizontal_TabUp.circuit.json",
)

const svgContent = convertCircuitJsonToPcbSvg(combinedFootprintElements, {
showCourtyards: true,
})
expect(svgContent).toMatchSvgSnapshot(import.meta.path, "to220h_3_tabup")
expect(booleanDifferenceSvg).toMatchSvgSnapshot(
import.meta.path,
"to220h_3_tabup_boolean_difference",
)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

This test file contains 2 test() calls (lines 5-20 and 22-37), which violates the rule that a *.test.ts file may have AT MOST one test(...). After the first test, the user should split into multiple, numbered files. To fix this, split the file into two separate files: 'to220h_3_kicad_parity1.test.ts' for the first test and 'to220h_3_kicad_parity2.test.ts' for the second test.

Spotted by Graphite (based on custom rule: Custom rule)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@victorjzq
Copy link
Contributor Author

Closing in favor of #534 which includes proper /claim format.

@victorjzq
Copy link
Contributor Author

/claim #185

Re-opening this PR (mistakenly closed). Full TO-220 horizontal implementation with KiCad-compatible pads, TabDown/TabUp variants, and 387 passing tests.

@victorjzq
Copy link
Contributor Author

Fixed graphite-app review: split to220h_3_kicad_parity.test.ts (which had 2 tests) into to220h_3_kicad_parity1.test.ts and to220h_3_kicad_parity2.test.ts — one test per file.

@victorjzq
Copy link
Contributor Author

/claim #185

Fixes #185

@victorjzq
Copy link
Contributor Author

Hey @MustafaMulla29 @rushabhcodes — this PR is CI-green and ready for review. Thanks!

Copy link
Contributor

@rushabhcodes rushabhcodes left a comment

Choose a reason for hiding this comment

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

remove updfn4ep from this pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implement TO-220 horizontal variant

2 participants