diff --git a/bun.lock b/bun.lock index 50bf881..6f72f97 100644 --- a/bun.lock +++ b/bun.lock @@ -6,7 +6,7 @@ "name": "jscad-electronics", "devDependencies": { "@biomejs/biome": "^1.9.3", - "@tscircuit/footprinter": "^0.0.374", + "@tscircuit/footprinter": "^0.0.391", "@types/react": "19", "@types/react-dom": "19", "@types/three": "^0.179.0", @@ -179,7 +179,7 @@ "@tscircuit/alphabet": ["@tscircuit/alphabet@0.0.24", "", { "peerDependencies": { "typescript": "^5.0.0" } }, "sha512-vYYLwDwpTULFDwuqB5+U4RlTiHJ3Ez4Sf5OEv7rB1oVbhmh8p3Xl7h3vsi5eD4SE+x+0e8eSXKSlwSLCN94vZA=="], - "@tscircuit/footprinter": ["@tscircuit/footprinter@0.0.374", "", { "dependencies": { "@tscircuit/mm": "^0.0.8", "zod": "^3.23.8" }, "peerDependencies": { "circuit-json": "*" } }, "sha512-TqcB8fBoquEWCOIttNSvq3OD+g3j9INFn0Zn//Jmje8U42TW7SpxW5vF+N04zoCmIQ3WkMpeC2032zD4uYbg5Q=="], + "@tscircuit/footprinter": ["@tscircuit/footprinter@0.0.391", "", { "dependencies": { "@tscircuit/mm": "^0.0.8", "zod": "^3.23.8" }, "peerDependencies": { "circuit-json": "*" } }, "sha512-6sUm5uyUJjk0U19Fy1J6w5lfxdB1kQe8lMTtWjjnSTP2dCKmcoBS1Hy5bWhvRuWllYwZkAwztsHYI9DnYDoj6w=="], "@tscircuit/mm": ["@tscircuit/mm@0.0.8", "", { "peerDependencies": { "typescript": "^5.0.0" } }, "sha512-nl7nxE7AhARbKuobflI0LUzoir7+wJyvwfPw6bzA/O0Q3YTcH3vBkU/Of+V/fp6ht+AofiCXj7YAH9E446138Q=="], diff --git a/examples/footprinter3d/fp-wson8.example.tsx b/examples/footprinter3d/fp-wson8.example.tsx new file mode 100644 index 0000000..67f3869 --- /dev/null +++ b/examples/footprinter3d/fp-wson8.example.tsx @@ -0,0 +1,12 @@ +import { JsCadView } from "jscad-fiber" +import { ExtrudedPads } from "lib/ExtrudedPads" +import { Footprinter3d } from "lib/Footprinter3d" + +const footprint = "wson8_ep" + +export default () => ( + + + + +) diff --git a/lib/Footprinter3d.tsx b/lib/Footprinter3d.tsx index a32c152..00fba39 100644 --- a/lib/Footprinter3d.tsx +++ b/lib/Footprinter3d.tsx @@ -57,6 +57,7 @@ import { StampBoard } from "./stampboard" import { MountedPcbModule } from "./MountedPcbModule" import SOD723 from "./SOD723" import { JSTZH1_5mm } from "./JSTZH1_5mm" +import { WSON } from "./WSON" /** * Outputs a 3d model for any [footprinter string](https://github.com/tscircuit/footprinter) @@ -103,6 +104,10 @@ export const Footprinter3d = ({ footprint }: { footprint: string }) => { screenheight?: number screencenteroffsetx?: number screencenteroffsety?: number + rowspan?: number + ep?: boolean + epw?: number + eph?: number } switch (fpJson.fn) { @@ -205,6 +210,21 @@ export const Footprinter3d = ({ footprint }: { footprint: string }) => { ) } + case "wson": + return ( + + ) + case "pinrow": { // Parse rows parameter from footprint string (e.g., "pinrow4_rows2") const rowsMatch = footprint.match(/_rows(\d+)/) diff --git a/lib/WSON.tsx b/lib/WSON.tsx new file mode 100644 index 0000000..71f4a2d --- /dev/null +++ b/lib/WSON.tsx @@ -0,0 +1,70 @@ +import { Cuboid, Cylinder, RoundedCuboid } from "jscad-fiber" + +export interface WSONProps { + pitch?: number + rowSpan?: number + padLength?: number + padWidth?: number + exposedPad?: boolean + exposedPadWidth?: number + exposedPadHeight?: number + bodyWidth?: number + bodyLength?: number + bodyHeight?: number +} + +export const WSON = ({ + pitch = 0.5, + rowSpan = 3.015, + padLength = 0.6, + padWidth = 0.28, + exposedPad = true, + exposedPadWidth = 1.7, + exposedPadHeight = 0.3, + bodyWidth = 2, + bodyLength = 3, + bodyHeight = 0.75, +}: WSONProps) => { + const contactHeight = 0.05 + const startX = (-3 * pitch) / 2 + const cornerRadius = Math.min(0.1, bodyWidth / 8, bodyLength / 8) + + return ( + <> + {Array.from({ length: 4 }, (_, index) => { + const x = startX + index * pitch + return [-1, 1].map((direction) => ( + + )) + })} + {exposedPad && ( + + )} + + + + ) +} diff --git a/lib/index.ts b/lib/index.ts index c3ad613..7e1a18e 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -70,3 +70,4 @@ export * from "./TO92" export * from "./MountedPcbModule" export * from "./Screen" export * from "./JSTZH1_5mm" +export * from "./WSON" diff --git a/package.json b/package.json index 6b6f4d0..767d7c0 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ }, "devDependencies": { "@biomejs/biome": "^1.9.3", - "@tscircuit/footprinter": "^0.0.374", + "@tscircuit/footprinter": "^0.0.391", "@types/react": "19", "@types/react-dom": "19", "@types/three": "^0.179.0", diff --git a/tests/snapshots/__snapshots__/wson.snap.png b/tests/snapshots/__snapshots__/wson.snap.png new file mode 100644 index 0000000..8ece5d4 Binary files /dev/null and b/tests/snapshots/__snapshots__/wson.snap.png differ diff --git a/tests/snapshots/wson.test.ts b/tests/snapshots/wson.test.ts new file mode 100644 index 0000000..9a61e38 --- /dev/null +++ b/tests/snapshots/wson.test.ts @@ -0,0 +1,8 @@ +import { expect, test } from "bun:test" +import "../fixtures/png-matcher" +import { renderFootprint } from "../helpers/render-footprint" + +test("WSON-8 package", async () => { + const pngBuffer = await renderFootprint("wson8_ep") + await expect(pngBuffer).toMatchPngSnapshot(import.meta.path) +})