-
Notifications
You must be signed in to change notification settings - Fork 5
Project: Shelves
pentacular edited this page Sep 3, 2019
·
9 revisions
const width = 285;
const depth = 220;
const height = 390;
Set up the basic shelf and beam shapes.
const shelf = Square(width, depth)
.extrude(4.7).back()
.material('wood').color('beige')
.as('shelf');
const beam = Square(10, height)
.extrude(4.7).rotateX(90)
.material('wood').color('bisque')
.as('beam');
We need the beams to be in two parts:
- The supports which should be cut by the shelves.
- The beams which should cut the shelves.
const supports = assemble(
beam.left().move(width / 2 - 10, 30),
beam.right().move(width / -2 + 10, 30),
beam.left().move(width / 2 - 10, depth - 30).as('beam', 'reference beam'),
beam.right().move(width / -2 + 10, depth - 30));
const beams = assemble(
beam.left().move(width / 2, 30),
beam.right().move(width / - 2, 30),
beam.left().move(width / 2, depth - 30).as('beam', 'reference beam'),
beam.right().move(width / - 2, depth - 30));
Put some stuff on a shelf to see how it looks.
const stuff = assemble(Cube(50).rotateZ(12)
.material('metal').color('red'),
Cylinder(10, 60)
.material('glass').color('green')
.move(80));
const shelves = assemble(
shelf.move(0, 0, height / 6)
.as('shelf', 'reference shelf'),
stuff.material('metal')
.move(0, 100)
.as('stuff')
.above(shelf.move(0, 0, -height / 6)));
Put the whole thing together.
const design = assemble(
Cube(width + 20, depth + 20, height + 20)
.back().material('metal').color('sandybrown')
.as('cabinet'),
Cube(width, depth, height).back().drop(),
supports,
shelves,
beams).above();
Generate a pdf for laser cutting the beams.
Note the use of fuse() to merge the beam elements into a single solid for outlining.
design.keep('reference beam').rotateX(90).center().fuse().section().outline()
.writePdf('beam.pdf');
Generate a pdf for laser cutting the shelves.
design.keep('reference shelf').center().section().outline()
.writePdf('shelf.pdf');
And return the full assembly to see how it should fit together.
This view can be downloaded as view only html page.
design.center()
.writeThreejsPage({
path: 'shelves.html',
view: {
position: [0, -1200, 0],
target: [0, 0, 0]
}
});