|
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]) |
|
] |
|
} |