diff --git a/lib/FemaleHeader.tsx b/lib/FemaleHeader.tsx index 466284f..81bba3d 100644 --- a/lib/FemaleHeader.tsx +++ b/lib/FemaleHeader.tsx @@ -1,4 +1,4 @@ -import { Colorize, Cuboid, Cylinder, Hull, Subtract } from "jscad-fiber" +import { Colorize, Cuboid, Hull, Subtract } from "jscad-fiber" export const FemaleHeader = ({ x, @@ -23,7 +23,14 @@ export const FemaleHeader = ({ bodyWidth?: number flipZ: (z: number) => number }) => { - const pinThickness = innerDiameter / 1.5 + const effectiveInnerDiameter = innerDiameter || 0.945 + const pinThickness = effectiveInnerDiameter / 1.5 + const socketWidth = effectiveInnerDiameter + const socketEntryWidth = socketWidth * 1.8 + const socketEntryHeight = Math.min(bodyHeight * 0.18, pitch * 0.24) + const socketDepth = bodyHeight + 0.1 + const socketCenterZ = flipZ(z + socketDepth / 2) + const socketEntryBaseZ = z + bodyHeight - socketEntryHeight const gapWidth = pinThickness * 1.6 return ( @@ -35,19 +42,20 @@ export const FemaleHeader = ({ size={[bodyLength, bodyWidth, bodyHeight]} center={[x, y, flipZ(z + bodyHeight / 2)]} /> - {innerDiameter ? ( - + + - ) : ( - )} + diff --git a/tests/snapshots/__snapshots__/pinrow6_female.snap.png b/tests/snapshots/__snapshots__/pinrow6_female.snap.png new file mode 100644 index 0000000..53d8487 Binary files /dev/null and b/tests/snapshots/__snapshots__/pinrow6_female.snap.png differ diff --git a/tests/snapshots/pinrow6_female.test.ts b/tests/snapshots/pinrow6_female.test.ts new file mode 100644 index 0000000..e3b3f2b --- /dev/null +++ b/tests/snapshots/pinrow6_female.test.ts @@ -0,0 +1,13 @@ +import { test, expect } from "bun:test" +import "../fixtures/png-matcher" +import { renderFootprint } from "../helpers/render-footprint" + +test("6-pin pinrow with 2 rows", async () => { + const pngBuffer = await renderFootprint( + "pinrow6_rows2_female_id01mm_p2.54mm_od01.6mm", + { + cameraPreset: "top-center-angled", + }, + ) + await expect(pngBuffer).toMatchPngSnapshot(import.meta.path) +})