diff --git a/examples/electrolytic.example.tsx b/examples/electrolytic.example.tsx new file mode 100644 index 0000000..0c8cdb5 --- /dev/null +++ b/examples/electrolytic.example.tsx @@ -0,0 +1,13 @@ +import { JsCadView } from "jscad-fiber" +import { ExtrudedPads, Footprinter3d } from "../lib" + +const footprint = "electrolytic_d10.5mm_p7.5mm" + +export default () => { + return ( + + + + + ) +} diff --git a/lib/ElectrolyticCapacitor.tsx b/lib/ElectrolyticCapacitor.tsx new file mode 100644 index 0000000..7061743 --- /dev/null +++ b/lib/ElectrolyticCapacitor.tsx @@ -0,0 +1,93 @@ +import { Cuboid, Cylinder } from "jscad-fiber" + +export interface ElectrolyticCapacitorProps { + pitch?: number + diameter?: number + height?: number + leadDiameter?: number + standoffHeight?: number + leadEmbedDepth?: number + leadInsertionDepth?: number + bodyColor?: string + stripeColor?: string +} + +export const ElectrolyticCapacitor = ({ + pitch = 7.5, + diameter = 10.5, + height, + leadDiameter = 0.6, + standoffHeight = 8, + leadEmbedDepth = 0.75, + leadInsertionDepth = 4, + bodyColor = "#202b3c", + stripeColor = "#c7c9cc", +}: ElectrolyticCapacitorProps) => { + const bodyHeight = height ?? diameter * 1.2 + const bodyRadius = diameter / 2 + const bodyCenterZ = standoffHeight + bodyHeight / 2 + const bodyTopZ = standoffHeight + bodyHeight + const leadTopZ = standoffHeight + leadEmbedDepth + const leadBottomZ = -leadInsertionDepth + const leadHeight = leadTopZ - leadBottomZ + const leadCenterZ = (leadTopZ + leadBottomZ) / 2 + const leadRadius = leadDiameter / 2 + const bungHeight = Math.min(0.6, bodyHeight * 0.08) + const topDiscHeight = Math.min(0.2, bodyHeight * 0.03) + const polarityStripeWidth = Math.min(1.6, diameter * 0.18) + const polarityStripeDepth = Math.min(0.18, diameter * 0.025) + const ventWidth = diameter * 0.52 + const ventThickness = Math.max(0.1, diameter * 0.015) + + return ( + <> + {[-pitch / 2, pitch / 2].map((x) => ( + + ))} + + + + + + + + + + + + + ) +} diff --git a/lib/Footprinter3d.tsx b/lib/Footprinter3d.tsx index 3f71c7e..3232cb3 100644 --- a/lib/Footprinter3d.tsx +++ b/lib/Footprinter3d.tsx @@ -60,6 +60,7 @@ import { JSTZH1_5mm } from "./JSTZH1_5mm" import { Crystal } from "./Crystal" import { FPC } from "./FPC" import { SmdPinHeader } from "./SmdPinHeader" +import { ElectrolyticCapacitor } from "./ElectrolyticCapacitor" import { Led5050 } from "./Led5050" import { RJ45 } from "./RJ45" @@ -121,6 +122,7 @@ export const Footprinter3d = ({ footprint }: { footprint: string }) => { mounttop?: boolean mpw?: number mpl?: number + d?: number ledpins?: boolean firstpinleft?: boolean firstpintop?: boolean @@ -156,6 +158,10 @@ export const Footprinter3d = ({ footprint }: { footprint: string }) => { ) case "axial": return + case "electrolytic": + return ( + + ) case "tssop": return ( { + const pngBuffer = await renderFootprint("electrolytic_d10.5mm_p7.5mm") + await expect(pngBuffer).toMatchPngSnapshot(import.meta.path) +})