Skip to content

to220 uses a body-width-derived pin pitch (2.6mm) instead of the standard 2.54mm #790

Description

@zkasuran

to220 computes its lead pitch from the plastic body width instead of using the fixed TO-220 pitch:

const minPitch = 2.5
const maxHoleWidth = w * 0.4
const computedPitch = Math.max(minPitch, maxHoleWidth / (numPins - 1))

For the default 3-pin part (w = 13mm) that resolves to 2.6mm, so the pins land 0.06mm off per step from the JEDEC TO-220 pitch of 0.1 inch (2.54mm). Two follow-on problems:

  • the pitch changes whenever the body width changes, but a TO-220 lead pitch is fixed regardless of body size
  • the p parameter is declared (default 5.0mm) yet never read, so to220_p2.54mm has no effect

The pads are also plain circular holes, while KiCad TO-220-3_Vertical uses a rectangular pin-1 pad plus pill lead pads. Running the repo parity harness against Package_TO_SOT_THT.pretty/TO-220-3_Vertical:

courtyardDiffPercent  17.02%
avgRelDiff (copper)   36.52%

The sibling to220f already hardcodes the right value with the comment TO-220F uses 2.54mm standard pitch to match KiCad, so the fix is to bring to220 onto the same KiCad TO-220-3 land.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions