Skip to content

Instantly share code, notes, and snippets.

@ahdinosaur
Last active February 2, 2022 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahdinosaur/8ac03be52677097ccd244fb88725b226 to your computer and use it in GitHub Desktop.
Save ahdinosaur/8ac03be52677097ccd244fb88725b226 to your computer and use it in GitHub Desktop.
Cutting Jig for Grid Beam (for use with openjscad.xyz)
/**
* 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