Skip to content

Support offset thermal pads - #750

Merged
seveibar merged 2 commits into
mainfrom
codex/thermalpad-offset
Jul 28, 2026
Merged

Support offset thermal pads#750
seveibar merged 2 commits into
mainfrom
codex/thermalpad-offset

Conversation

@seveibar

@seveibar seveibar commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add signed thermalpadcenteroffsetx and thermalpadcenteroffsety parameters to QFN/DFN/SOIC/TSSOP/SSOP/MSOP/VSSOP footprints
  • keep both offsets at zero by default, preserving existing footprints
  • include offset thermal pads in quad-family courtyard bounds
  • add geometry assertions and SVG snapshots for DFN and QFN offsets

Why

Several common JLCPCB power packages use an exposed pad that is intentionally displaced from the perimeter-pad center. A centered-only thermal pad caps otherwise accurate matches around 80–86% copper IoU.

This enables strings such as:

dfn8_thermalpad2.4mmx2.1mm_thermalpadcenteroffsety0.35mm

Validation

  • bun run build
  • bun test tests/dual-row-thermalpad.test.ts tests/qfn.test.ts (12 pass)
  • full suite: 498 pass; five unrelated pre-existing diode/MELF visual diffs under the locally rebuilt Sharp renderer

@seveibar
seveibar marked this pull request as ready for review July 28, 2026 22:03
@seveibar
seveibar requested a review from techmannih as a code owner July 28, 2026 22:03
@seveibar
seveibar merged commit c1d04e2 into main Jul 28, 2026
4 checks passed
Comment thread tests/qfn.test.ts
Comment on lines +34 to +59
test("qfn thermal pad supports independent x and y offsets", () => {
const soup = fp
.string(
"qfn32_thermalpad3.1x3.1mm_thermalpadcenteroffsetx0.25mm_thermalpadcenteroffsety-0.4mm",
)
.circuitJson()
const thermalPad = soup.find(
(element) =>
element.type === "pcb_smtpad" &&
element.port_hints.includes("thermalpad"),
)

expect(thermalPad).toMatchObject({
shape: "rect",
x: 0.25,
y: -0.4,
width: 3.1,
height: 3.1,
})

const svgContent = convertCircuitJsonToPcbSvg(soup)
expect(svgContent).toMatchSvgSnapshot(
import.meta.path,
"qfn32_offset_thermalpad",
)
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A *.test.ts file may have AT MOST one test(...). This file already contained at least one test(...) block (visible at line 31 and below), and now a second test("qfn thermal pad supports independent x and y offsets", ...) has been added, followed by yet another test("qfn20 supports explicit and shared side pin counts", ...) at line 61. Per the style guide, once a file has more than one test it must be split into multiple numbered files (e.g. qfn1.test.ts, qfn2.test.ts). Move this new test into its own dedicated file such as qfn-offset-thermalpad.test.ts or a numbered variant.

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

Fix in Graphite


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

@tscircuitbot

Copy link
Copy Markdown
Contributor

Thank you for your contribution! 🎉

PR Rating: ⭐⭐
Impact: Minor

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


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