Skip to content

Instantly share code, notes, and snippets.

@jamesporter
Last active December 30, 2025 21:21
Show Gist options
  • Select an option

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

Select an option

Save jamesporter/6d8edbb98b3f5b683e3ab6d4013b4277 to your computer and use it in GitHub Desktop.
Under Desk SSD shelf.
const { makeBox, draw, drawCircle, drawRectangle, makePlane, makeCylinder, EdgeFinder } = replicad;
export const defaultParams = {
depth: 120,
width: 30
};
function createScrewHole(h) {
return draw()
.hLine(1.5).vLine(h - 3).lineTo([3.5, h]).hLine(-3.5)
.close()
.sketchOnPlane("XZ")
.revolve()
.mirror("XY")
}
export default function main({depth, width}) {
const front = draw()
.hLine(width).vLine(30).hLine(-width).vLine(-5).hLine(width - 5).vLine(-20).hLine(-width + 5)
.close().sketchOnPlane("XZ").extrude(depth)
const back = draw().hLine(width).vLine(30).hLine(-width).vLine(-10).hLine(10).vLine(-10).hLine(-10).close()
.sketchOnPlane(makePlane("XZ", depth)).extrude(5)
const edgesToFillet = new EdgeFinder().and([
e => e.not((e) => e.inPlane("XY", 30)),
e => e.not((e) => e.inPlane("YZ"))
])
const xT = (width - 5) / 2
const side = front.fuse(back).fillet(2, () => edgesToFillet)
.cut(createScrewHole(30).translate(xT, -20, 55))
.cut(createScrewHole(30).translate(xT, -depth + 20, 55))
.cut(makeCylinder(5, 5, [xT,-20]))
.cut(makeCylinder(5, 5, [xT,-depth + 20]))
return [side, side.clone().mirror("YZ").translate([-20,0,0])]
};
const { makeBox, draw, drawCircle, drawRectangle, makePlane, makeCylinder, EdgeFinder } = replicad;
export const defaultParams = {
depth: 120
};
function createScrewHole(h) {
return draw()
.hLine(1.5).vLine(h - 3).lineTo([3.5, h]).hLine(-3.5)
.close()
.sketchOnPlane("XZ")
.revolve()
.mirror("XY")
}
export default function main({depth}) {
const front = draw()
.hLine(45).vLine(30).hLine(-45).vLine(-5).hLine(40).vLine(-20).hLine(-40)
.close().sketchOnPlane("XZ").extrude(depth)
const back = draw().hLine(45).vLine(30).hLine(-45).vLine(-10).hLine(10).vLine(-10).hLine(-10).close()
.sketchOnPlane(makePlane("XZ", depth)).extrude(5)
const edgesToFillet = new EdgeFinder().and([
e => e.not((e) => e.inPlane("XY", 30)),
e => e.not((e) => e.inPlane("YZ"))
])
const side = front.fuse(back).fillet(2, () => edgesToFillet)
.cut(createScrewHole(30).translate(20, -20, 55))
.cut(createScrewHole(30).translate(20, -depth + 20, 55))
.cut(makeCylinder(5, 5, [20,-20]))
.cut(makeCylinder(5, 5, [20,-depth + 20]))
return [side, side.clone().mirror("YZ").translate([-20,0,0])]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment