From 4397ee1a116bab04b3b4cc3e23b3fee315d3835e Mon Sep 17 00:00:00 2001 From: Isaac Poole Date: Tue, 26 Nov 2024 22:50:40 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(enclosure):=20add=20unit=20con?= =?UTF-8?q?version=20functionality?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - import and configure 'convert' module for unit conversion - initialize constants for rod, buttons, and dimensions with conversions 📦 build(dependencies): include 'convert' package - add 'convert' to package.json and package-lock.json for unit conversion functionality --- hardware/enclosure/index.ts | 22 ++++++++++++++++++++++ hardware/enclosure/package-lock.json | 8 ++++++++ hardware/enclosure/package.json | 3 ++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/hardware/enclosure/index.ts b/hardware/enclosure/index.ts index bf09438..ddcb826 100644 --- a/hardware/enclosure/index.ts +++ b/hardware/enclosure/index.ts @@ -1,4 +1,26 @@ import { cube } from "@jscad/modeling/src/primitives"; +import convert from "convert"; + +const rod = { + length: convert(2, "ft").to("mm"), + diameter: convert(3 / 4, "in").to("mm"), + nut: { + height: convert(1 / 2, "in").to("mm"), + clearance: convert(1, "in").to("mm"), + }, +}; + +const buttons = { + diameter: convert(1 / 2, "in").to("mm"), + count: 8, +}; + +const dimensions = { + face: convert(3, "in").to("mm"), + back: convert(3 / 2, "in").to("mm"), + angle: convert(45, "deg").to("rad"), + thickness: convert(1 / 4, "in").to("mm"), +}; export const main = () => { return cube({ size: 20 }); diff --git a/hardware/enclosure/package-lock.json b/hardware/enclosure/package-lock.json index f8a791c..c0e1c58 100644 --- a/hardware/enclosure/package-lock.json +++ b/hardware/enclosure/package-lock.json @@ -12,6 +12,7 @@ "@jscad/cli": "^2.3.2", "@jscad/modeling": "^2.12.2", "@types/node": "^22.0.0", + "convert": "^5.6.1", "tsc-watch": "^6.2.0", "typescript": "^5.5.3" } @@ -310,6 +311,13 @@ "undici-types": "~6.20.0" } }, + "node_modules/convert": { + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/convert/-/convert-5.6.1.tgz", + "integrity": "sha512-soawGcYN1XNhtSBzBf7qKFAhmiuBy6ee643ppPPxJUgSYkjZs5mkg/QEf02fS4Iwiycn1YPSm2a4O+QnXQEVZQ==", + "dev": true, + "license": "MIT" + }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", diff --git a/hardware/enclosure/package.json b/hardware/enclosure/package.json index 16c5cad..501c89e 100644 --- a/hardware/enclosure/package.json +++ b/hardware/enclosure/package.json @@ -13,7 +13,8 @@ "@jscad/cli": "^2.3.2", "@jscad/modeling": "^2.12.2", "@types/node": "^22.0.0", + "convert": "^5.6.1", "tsc-watch": "^6.2.0", "typescript": "^5.5.3" } -} \ No newline at end of file +}