import { saddleDimensions, saddleOutline, saddleScrewOutline, saddleValues, SADDLE_PRINT_GAP, validateSaddle } from "../electronics-saddle"; import type { CadKernel, CadParameters, Manifold } from "./kernel"; /** Original measured cradle pair, already laid out on flat faces for printing. */ export function buildElectronicsSaddle(k: CadKernel, input: CadParameters): Manifold { validateSaddle(input); const p = saddleValues(input), d = saddleDimensions(input); const body = k.extrude(k.polygon(saddleOutline(input)), p.saddle_width); // Rotate an XZ teardrop extrusion onto the installed screw axis (print Y). const cutter = k.rotate(k.extrude(k.polygon(saddleScrewOutline(input)), p.ear + 2), [90, 0, 0]); const saddle = k.difference(body, ...[-1, 1].map(side => k.move(cutter, [side * p.screw_pitch / 2, d.height + 1, p.saddle_width / 2]))); return k.union(saddle, k.move(saddle, [0, d.height + SADDLE_PRINT_GAP, 0])); }