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-smdpushbutton4.example.tsx b/examples/footprinter3d/fp-smdpushbutton4.example.tsx
new file mode 100644
index 0000000..844e0ad
--- /dev/null
+++ b/examples/footprinter3d/fp-smdpushbutton4.example.tsx
@@ -0,0 +1,12 @@
+import { JsCadView } from "jscad-fiber"
+import { ExtrudedPads } from "lib/ExtrudedPads"
+import { Footprinter3d } from "lib/Footprinter3d"
+
+const footprint = "smdpushbutton4"
+
+export default () => (
+
+
+
+
+)
diff --git a/lib/Footprinter3d.tsx b/lib/Footprinter3d.tsx
index a32c152..be7a022 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 { SmdPushButton } from "./SmdPushButton"
/**
* Outputs a 3d model for any [footprinter string](https://github.com/tscircuit/footprinter)
@@ -103,6 +104,9 @@ export const Footprinter3d = ({ footprint }: { footprint: string }) => {
screenheight?: number
screencenteroffsetx?: number
screencenteroffsety?: number
+ px?: number
+ py?: number
+ ph?: number
}
switch (fpJson.fn) {
@@ -282,6 +286,15 @@ export const Footprinter3d = ({ footprint }: { footprint: string }) => {
innerDiameter={fpJson.id}
/>
)
+ case "smdpushbutton":
+ return (
+
+ )
case "jst":
if (fpJson.zh) {
return
diff --git a/lib/SmdPushButton.tsx b/lib/SmdPushButton.tsx
new file mode 100644
index 0000000..dc89440
--- /dev/null
+++ b/lib/SmdPushButton.tsx
@@ -0,0 +1,75 @@
+import { Cuboid, Cylinder, RoundedCuboid } from "jscad-fiber"
+
+export interface SmdPushButtonProps {
+ padPitchX?: number
+ padPitchY?: number
+ padWidth?: number
+ padHeight?: number
+}
+
+export const SmdPushButton = ({
+ padPitchX = 4.2,
+ padPitchY = 2.15,
+ padWidth = 1.05,
+ padHeight = 0.7,
+}: SmdPushButtonProps) => {
+ const bodyWidth = Math.max(padPitchX - padWidth, 2)
+ const bodyLength = Math.max(padPitchY + padHeight - 0.25, 1.8)
+ const terminalLength = Math.max((padPitchX + padWidth - bodyWidth) / 2, 0.35)
+ const terminalX = bodyWidth / 2 + terminalLength / 2
+ const terminalHeight = 0.1
+ const frameHeight = 0.28
+ const housingHeight = 0.48
+ const actuatorHeight = 0.32
+
+ return (
+ <>
+ {[-1, 1].flatMap((xDirection) =>
+ [-1, 1].map((yDirection) => (
+
+ )),
+ )}
+
+
+
+
+ >
+ )
+}
diff --git a/lib/index.ts b/lib/index.ts
index c3ad613..06aaa28 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 "./SmdPushButton"
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__/smdpushbutton.snap.png b/tests/snapshots/__snapshots__/smdpushbutton.snap.png
new file mode 100644
index 0000000..ea23ea9
Binary files /dev/null and b/tests/snapshots/__snapshots__/smdpushbutton.snap.png differ
diff --git a/tests/snapshots/smdpushbutton.test.ts b/tests/snapshots/smdpushbutton.test.ts
new file mode 100644
index 0000000..81f38a9
--- /dev/null
+++ b/tests/snapshots/smdpushbutton.test.ts
@@ -0,0 +1,8 @@
+import { expect, test } from "bun:test"
+import "../fixtures/png-matcher"
+import { renderFootprint } from "../helpers/render-footprint"
+
+test("SMD push button", async () => {
+ const pngBuffer = await renderFootprint("smdpushbutton4")
+ await expect(pngBuffer).toMatchPngSnapshot(import.meta.path)
+})