Skip to content

Instantly share code, notes, and snippets.

@tuefekci
Last active January 19, 2026 17:55
Show Gist options
  • Select an option

  • Save tuefekci/2a6e8a1bc0a6f8a894f1a1606f3eb3e0 to your computer and use it in GitHub Desktop.

Select an option

Save tuefekci/2a6e8a1bc0a6f8a894f1a1606f3eb3e0 to your computer and use it in GitHub Desktop.
const { cuboid, cylinder } = require('@jscad/modeling').primitives
const { subtract, union } = require('@jscad/modeling').booleans
const { translate, rotateY } = require('@jscad/modeling').transforms
const main = () => {
// -------------------------
// PARAMETERS
// -------------------------
const spacerThickness = 50
const spacerWidth = 30
const spacerDepth = 50
const plateHeight = 35 // 35
const plateThickness = 5
const screwDiameter = 5
const screwSpacing = 30
const realPlateHeight = (plateHeight + spacerThickness);
// -------------------------
// SPACER BLOCK
// -------------------------
const spacer = translate(
[0, 0, spacerThickness / 2],
cuboid({ size: [spacerWidth, spacerDepth, spacerThickness] })
)
// -------------------------
// SIDE PLATE
// -------------------------
const plate = translate(
[
spacerWidth / 2 + plateThickness / 2,
0,
realPlateHeight / 2
],
cuboid({ size: [plateThickness, spacerDepth, realPlateHeight] })
)
// -------------------------
// COMBINE SOLID
// -------------------------
const body = union(spacer, plate)
// -------------------------
// SCREW HOLES (EXTRA LONG!)
// -------------------------
const hole = rotateY(
Math.PI / 2,
cylinder({
height: plateThickness + 20, // MUST exceed plate
radius: screwDiameter / 2,
segments: 32
})
)
const holeTop = translate(
[
spacerWidth / 2 + plateThickness / 2,
-10,
spacerThickness + realPlateHeight - (realPlateHeight / 1.35),
],
hole
)
const holeBottom = translate(
[
spacerWidth / 2 + plateThickness / 2,
+10,
spacerThickness + realPlateHeight - (realPlateHeight / 1.2)
],
hole
)
// -------------------------
// SUBTRACT LAST
// -------------------------
return subtract(body, holeTop, holeBottom)
}
module.exports = { main }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment