Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions src/fn/sot343.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ import { z } from "zod"
import { rectpad } from "../helpers/rectpad"
import { base_def } from "../helpers/zod/base_def"

// Matches KiCad Package_TO_SOT_SMD.pretty SOT-343_SC-70-4 exactly
// (outer edge +/-1.45, inner arms +/-0.73, y +/-0.98 with +/-1.1 tabs).
const sot343CourtyardOutline = [
{ x: -1.703, y: 0.98 },
{ x: -0.983, y: 0.98 },
{ x: -0.983, y: 1.1 },
{ x: 0.477, y: 1.1 },
{ x: 0.477, y: 0.98 },
{ x: 1.197, y: 0.98 },
{ x: 1.197, y: -0.98 },
{ x: 0.477, y: -0.98 },
{ x: 0.477, y: -1.1 },
{ x: -0.983, y: -1.1 },
{ x: -0.983, y: -0.98 },
{ x: -1.703, y: -0.98 },
{ x: -1.45, y: 0.98 },
{ x: -0.73, y: 0.98 },
{ x: -0.73, y: 1.1 },
{ x: 0.73, y: 1.1 },
{ x: 0.73, y: 0.98 },
{ x: 1.45, y: 0.98 },
{ x: 1.45, y: -0.98 },
{ x: 0.73, y: -0.98 },
{ x: 0.73, y: -1.1 },
{ x: -0.73, y: -1.1 },
{ x: -0.73, y: -0.98 },
{ x: -1.45, y: -0.98 },
]

export const sot343_def = base_def.extend({
Expand Down Expand Up @@ -64,10 +66,17 @@ export const getCcwSot343Coords = (parameters: {
p: number
}) => {
const { pn, p } = parameters
if (pn === 1) return { x: -p * 1.92, y: -0.65 }
if (pn === 2) return { x: -p * 1.92, y: 0.65 }
if (pn === 3) return { x: p, y: 0.65 }
if (pn === 4) return { x: p, y: -0.65 }
// SC-70-4 (SOT-343) is symmetric about the origin: both columns sit at
// ±p*1.92 from centre. The right column previously dropped the *1.92,
// shifting the part off origin (#667).
// SC-70-4 (SOT-343) is symmetric about the origin. KiCad's
// SOT-343_SC-70-4 places pads at +/-0.825mm (p*1.5 with the default
// 0.55mm pitch); the old code put the right column at +p*1 only and
// the left at -p*1.92, shifting the part off origin (#667).
if (pn === 1) return { x: -p * 1.5, y: -0.65 }
if (pn === 2) return { x: -p * 1.5, y: 0.65 }
if (pn === 3) return { x: p * 1.5, y: 0.65 }
if (pn === 4) return { x: p * 1.5, y: -0.65 }
return { x: 0, y: 0 }
}

Expand Down
2 changes: 1 addition & 1 deletion tests/__snapshots__/sot343.snap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading