Revert "Merge PR #29: add metric screw hole cutters"

This reverts commit bdab56468c, reversing
changes made to 70e45bb966.
This commit is contained in:
Formsmith
2026-07-16 12:37:54 +03:00
parent bdab56468c
commit 3a7db063e7
9 changed files with 5 additions and 661 deletions
-31
View File
@@ -1,31 +0,0 @@
import { describe, expect, it } from "vitest";
import { createScrewHoleShape, screwHoleDimensions, type ScrewHoleConfig } from "@/lib/screwHoles";
const m3Socket: ScrewHoleConfig = { metric: "M3", screwLength: 8, head: "socket", fit: "standard", mount: "clearance", depthMode: "through", depth: 20.4 };
describe("screw hole generator", () => {
it("uses the expected M3 clearance and socket recess dimensions", () => {
expect(screwHoleDimensions(m3Socket)).toMatchObject({ shaftDiameter: 3.4, headDiameter: 5.7, recessDepth: 3.1, totalDepth: 20.4, countersunk: false });
});
it("creates an editable native Hole cutter made from watertight primitives", () => {
const hole = createScrewHoleShape(m3Socket, { x: 12, z: -8, elevation: -0.4 }, "test-screw-hole");
expect(hole).toMatchObject({ id: "test-screw-hole", kind: "mesh", hole: true, x: 12, z: -8, elevation: -0.4, height: 20.4, screwHole: m3Socket });
expect(hole.importedMesh).toBeUndefined();
expect(hole.groupedShapes).toHaveLength(2);
expect(hole.groupedShapes?.[0]).toMatchObject({ kind: "cylinder", hole: true, elevation: 0, width: 3.4 });
expect(hole.groupedShapes?.[0]?.height).toBeCloseTo(17.3);
expect(hole.groupedShapes?.[1]).toMatchObject({ kind: "cylinder", hole: true, width: 5.7, height: 3.1 });
expect(hole.groupedShapes?.[1]?.elevation).toBeCloseTo(17.3);
});
it("supports a six-sided nut-trap cutter and a countersunk clearance cutter", () => {
const nutTrap = screwHoleDimensions({ ...m3Socket, mount: "nutTrap" });
const countersunk = screwHoleDimensions({ ...m3Socket, head: "countersunk" });
expect(nutTrap.sides).toBe(6);
expect(nutTrap.headDiameter).toBeGreaterThan(nutTrap.shaftDiameter);
expect(countersunk.countersunk).toBe(true);
const countersunkCutter = createScrewHoleShape({ ...m3Socket, head: "countersunk" }, { x: 0, z: 0, elevation: 0 }, "countersink");
expect(countersunkCutter.groupedShapes).toEqual(expect.arrayContaining([expect.objectContaining({ kind: "cone", hole: true, baseRadius: countersunk.shaftDiameter / 2, topRadius: countersunk.headDiameter / 2 })]));
});
});
-10
View File
@@ -80,15 +80,6 @@ describe("SketchForge .skf project packages", () => {
mirrorX: index === 5,
sides: index + 3,
text: kind === "text" ? "Editable" : undefined,
screwHole: index === 0 ? {
metric: "M3",
screwLength: 8,
head: "socket",
fit: "standard",
mount: "clearance",
depthMode: "through",
depth: 16,
} : undefined,
sketchProfile: kind === "sketch" ? {
points: [
{ id: "p1", x: 0, z: 0 },
@@ -113,7 +104,6 @@ describe("SketchForge .skf project packages", () => {
expect(restored.workspace).toEqual(DEFAULT_WORKPLANE_WORKSPACE);
expect(restored.snapGrid).toBe(DEFAULT_SNAP_GRID);
expect(restored.placementElevation).toBe(12.5);
expect(restored.shapes[0].screwHole?.metric).toBe("M3");
expect(document.assets.filter((entry) => entry.kind === "derived-mesh")).toHaveLength(0);
});