Skip to content

fix: correct QFN/MLP pad positioning to match IPC-7351B#531

Open
blessuselessk wants to merge 1 commit intotscircuit:mainfrom
blessuselessk:fix/qfn-pad-positioning
Open

fix: correct QFN/MLP pad positioning to match IPC-7351B#531
blessuselessk wants to merge 1 commit intotscircuit:mainfrom
blessuselessk:fix/qfn-pad-positioning

Conversation

@blessuselessk
Copy link

@blessuselessk blessuselessk commented Mar 18, 2026

Summary

Fixes QFN and MLP pad positioning — pads were ~0.5mm too far inside the body due to:

  1. Hardcoded 0.1 offset in getQuadCoords applied to all packages equally
  2. Incorrect pcdfe calculation for legsoutside=false — used -pl/2 (fully inside body) instead of 0 (at body edge)

Before (QFN-32 5x5mm)

  • Pad center at ±1.9625mm — pad outer edge at ±2.4mm, entirely inside the 2.5mm body edge
  • 0.475mm error vs KiCad reference

After

  • Pad center at ±2.5mm (body edge) — pad straddles the edge per IPC-7351B
  • 0.0625mm error vs KiCad reference (within manufacturing tolerance)

Changes

  • quad.ts: Split offset into pcdfe (pad center distance) and edgeOffset (legacy QFP nudge). QFN/MLP get pcdfe=0, edgeOffset=0. QFP/TQFP/LQFP behavior unchanged.
  • qfn.ts: Changed !param to === undefined to allow explicit zero values for pl/pw.
  • Updated 7 SVG snapshots (QFN, MLP, quad tests).

Test plan

  • All 379 tests pass
  • Biome format clean
  • QFN-32 KiCad parity test updated (improved alignment)
  • QFP/TQFP/LQFP snapshots unchanged

QFN pads were positioned ~0.5mm too far inside the body due to a
hardcoded 0.1 offset and incorrect pcdfe calculation for legsoutside=false
packages. Now QFN/MLP pads center at the body edge (matching IPC-7351B),
while QFP/TQFP/LQFP behavior is unchanged.

Also fixes falsy-check (!param) to strict undefined check in qfn.ts
to allow explicit zero values.

Closes tscircuit#413
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.

1 participant