Skip to content
Closed
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
4 changes: 2 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions examples/footprinter3d/fp-wson8.example.tsx
Original file line number Diff line number Diff line change
@@ -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 () => (
<JsCadView zAxisUp showGrid>
<Footprinter3d footprint={footprint} />
<ExtrudedPads footprint={footprint} />
</JsCadView>
)
20 changes: 20 additions & 0 deletions lib/Footprinter3d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -205,6 +210,21 @@ export const Footprinter3d = ({ footprint }: { footprint: string }) => {
)
}

case "wson":
return (
<WSON
pitch={fpJson.p}
rowSpan={fpJson.rowspan}
padLength={fpJson.pl}
padWidth={fpJson.pw}
exposedPad={fpJson.ep}
exposedPadWidth={fpJson.epw}
exposedPadHeight={fpJson.eph}
bodyWidth={fpJson.w}
bodyLength={fpJson.h}
/>
)

case "pinrow": {
// Parse rows parameter from footprint string (e.g., "pinrow4_rows2")
const rowsMatch = footprint.match(/_rows(\d+)/)
Expand Down
70 changes: 70 additions & 0 deletions lib/WSON.tsx
Original file line number Diff line number Diff line change
@@ -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) => (
<Cuboid
key={`${index}:${direction}`}
color="#c8a84e"
center={[x, direction * (rowSpan / 2), contactHeight / 2]}
size={[padWidth, padLength, contactHeight]}
/>
))
})}
{exposedPad && (
<Cuboid
color="#c8a84e"
center={[0, 0, contactHeight / 2]}
size={[exposedPadWidth, exposedPadHeight, contactHeight]}
/>
)}
<RoundedCuboid
color="#303236"
center={[0, 0, contactHeight + bodyHeight / 2]}
size={[bodyWidth, bodyLength, bodyHeight]}
roundRadius={cornerRadius}
/>
<Cylinder
color="#777a7f"
center={[
-bodyWidth * 0.33,
-bodyLength * 0.37,
contactHeight + bodyHeight + 0.012,
]}
height={0.024}
radius={Math.min(bodyWidth, bodyLength) * 0.045}
/>
</>
)
}
1 change: 1 addition & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ export * from "./TO92"
export * from "./MountedPcbModule"
export * from "./Screen"
export * from "./JSTZH1_5mm"
export * from "./WSON"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Binary file added tests/snapshots/__snapshots__/wson.snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions tests/snapshots/wson.test.ts
Original file line number Diff line number Diff line change
@@ -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)
})
Loading