Skip to content

Instantly share code, notes, and snippets.

@jamesporter
Created January 5, 2026 21:33
Show Gist options
  • Select an option

  • Save jamesporter/bd66e6d20f1893c0d1b6c3fe264f3048 to your computer and use it in GitHub Desktop.

Select an option

Save jamesporter/bd66e6d20f1893c0d1b6c3fe264f3048 to your computer and use it in GitHub Desktop.
const { makeBox, draw, drawCircle, drawRectangle, makePlane, makeCylinder, EdgeFinder } = replicad;
const depth = 20
const width = 71
const height = 40
const radius = height / 2
function createScrewHole(h) {
return draw()
.hLine(1.5).vLine(h - 3).lineTo([3.5, h]).hLine(-3.5)
.close()
.sketchOnPlane("XZ")
.revolve()
.mirror("XY")
}
const insert = draw()
.movePointerTo([radius + 5, 5])
.hLine(width - 2 * radius)
.sagittaArc(0, 2 * radius , -radius)
.hLine(-width + 2 * radius)
.sagittaArc(0, -2 * radius , -radius)
.close()
.sketchOnPlane("XZ")
.extrude(depth)
const box = draw()
.hLine(width + 10)
.vLine(height + 10)
.hLine(-width - 10)
.vLine(-height - 10)
.close()
.sketchOnPlane("XZ")
.extrude(depth + 5)
const access = makeCylinder(7, 5, [10, -5], [0,1,0])
.translate(-1.5,0,radius + 5)
const screwHole = createScrewHole(5).translate(width/2 + 5, -depth/2 -2.5, height + 10)
const screwAccess = makeCylinder(5.5, 10, [width/2 + 5, -depth/2 - 2.5, -2])
export default function main() {
return [box
.fillet(2,e => e.not(f => f.inPlane("XY", height + 10)))
.cut(insert)
.cut(access)
.cut(screwHole)
.cut(screwAccess)
.rotate(90, [0,0,0], [1,0,0])
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment