Skip to content

Commit

Permalink
✨ feat(enclosure): add unit conversion functionality
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
isfopo committed Nov 27, 2024
1 parent ec942af commit 4397ee1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
22 changes: 22 additions & 0 deletions hardware/enclosure/index.ts
Original file line number Diff line number Diff line change
@@ -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 });
Expand Down
8 changes: 8 additions & 0 deletions hardware/enclosure/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion hardware/enclosure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}

0 comments on commit 4397ee1

Please sign in to comment.