-
-
Save ahdinosaur/8ac03be52677097ccd244fb88725b226 to your computer and use it in GitHub Desktop.
Cutting Jig for Grid Beam (for use with openjscad.xyz)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Cutting Jig for Grid Beam | |
* @category Grid Beam | |
* @skillLevel 1 | |
* @description A jig to help accurately cut to the grid | |
* @tags grid beam, cutting, jig | |
* @authors Michael Williams | |
* @licence LGPL-3.0 License | |
*/ | |
module.exports = { main } | |
const { subtract } = require('@jscad/modeling').booleans | |
const { translate } = require('@jscad/modeling').transforms | |
const { cuboid, cylinder } = require('@jscad/modeling').primitives | |
const GRID_SPACING = 40 | |
const CUTTER_KERF = 0.635 | |
const HOLE_DIAMETER = 7.5 // drill tap size | |
const JIG_BASE_GRIDS = 2 | |
const JIG_BASE_HEIGHT = 10 | |
const CYLINDER_RESOLUTION = 32 | |
function main() { | |
return subtract(jigBase(), jigHoles()) | |
} | |
function jigBase() { | |
const jigLength = GRID_SPACING * JIG_BASE_GRIDS | |
const jigWidth = GRID_SPACING | |
const jigHeight = JIG_BASE_HEIGHT | |
return cuboid({ | |
center: [(1 / 2) * jigLength, (1 / 2) * jigWidth, (1 / 2) * jigHeight], | |
size: [jigLength - 2 * CUTTER_KERF, jigWidth, jigHeight], | |
}) | |
} | |
function jigHoles() { | |
const holes = [] | |
for (let holeIndex = 0; holeIndex < JIG_BASE_GRIDS; holeIndex++) { | |
const hole = translate( | |
[(1 / 2 + holeIndex) * GRID_SPACING, (1 / 2) * GRID_SPACING, 0], | |
jigHole(), | |
) | |
holes.push(hole) | |
} | |
return holes | |
} | |
function jigHole() { | |
return cylinder({ | |
center: [0, 0, JIG_BASE_HEIGHT / 2], | |
height: JIG_BASE_HEIGHT, | |
radius: HOLE_DIAMETER / 2, | |
segments: CYLINDER_RESOLUTION, | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment