Created
December 21, 2025 22:59
-
-
Save jamesporter/82ae9b5c6d540dfebb4bf0d933656f9b to your computer and use it in GitHub Desktop.
WIP on a parametric under desk shelf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { makeBox, draw, drawCircle, drawRectangle, makePlane, makeCylinder, EdgeFinder } = replicad; | |
| export const defaultParams = { | |
| depth: 120, | |
| width: 300 | |
| }; | |
| function createScrewHole(h) { | |
| return draw() | |
| .hLine(1.5).vLine(h - 3).lineTo([3.5, h]).hLine(-3.5) | |
| .close() | |
| .sketchOnPlane("XZ") | |
| .revolve() | |
| .mirror("XY") | |
| } | |
| function createTriCutOut(a,b) { | |
| return draw().movePointerTo([30,0]) | |
| .lineTo([35,5]) | |
| .hLine(-5) | |
| .close() | |
| .sketchOnPlane("XZ", a) | |
| .extrude(b-a) | |
| } | |
| export default function main({depth, width}) { | |
| const front = draw() | |
| .movePointerTo([30,0]) | |
| .hLine(15) | |
| .vLine(30).hLine(-45).vLine(-5).hLine(40) | |
| .vLine(-20) | |
| .hLine(-10) | |
| .close().sketchOnPlane("XZ").extrude(depth) | |
| const back = draw() | |
| .movePointerTo([30,0]) | |
| .hLine(15).vLine(30). | |
| hLine(-45).vLine(-5) | |
| .cubicBezierCurveTo([30,0], [0, 15], [20, 0]) | |
| .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 base = draw() | |
| .hLine(-(width - 20)) | |
| .vLine(-depth) | |
| .hLine((width - 20)) | |
| .close() | |
| .sketchOnPlane("XY") | |
| .extrude(5) | |
| .fuse(createTriCutOut(10, 10 + depth/4).translate(-30,0,0)) | |
| .fuse(createTriCutOut(depth - 10 - (depth/4),depth - 10).translate(-30,0,0)) | |
| .fuse(createTriCutOut(10, 10 + depth/4).mirror("YZ") | |
| .translate(50 - width,0,0) | |
| ) | |
| .fuse(createTriCutOut(depth - 10 - (depth/4),depth - 10).mirror("YZ") | |
| .translate(50 - width,0,0) | |
| ) | |
| const side = front.fuse(back) | |
| // .fillet(2, () => edgesToFillet) | |
| .cut(createScrewHole(30).translate(20, -20, 55)) | |
| .cut(createScrewHole(30).translate(20, -depth + 20, 55)) | |
| .cut(createTriCutOut(10, 10 + depth/4)) | |
| .cut(createTriCutOut(depth - 10 - (depth/4),depth - 10)) | |
| // return side | |
| return [side, side.clone().mirror("YZ").translate([- width,0,0]), base] | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment