Created
September 4, 2019 21:19
-
-
Save potch/dea828bd94dfed64f286fa509d742ae9 to your computer and use it in GitHub Desktop.
laser turtles source file for spice racks
This file contains 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
UNIT = 'in'; | |
// 100 units in an inch | |
SUBDIV = 100; | |
// material thickness | |
const U = 12.5; | |
// width of rack | |
const width = 1000; | |
// number of shelves | |
const shelves = 3; | |
// height of each shelf | |
const shelfheight = 500; | |
const depth = 300; | |
// the spot I'm putting them is behind my range and there's limited room | |
// so I have a notch at the bottom to make it fit | |
const notch = 50; | |
// hight of the notched area | |
const rise = 125; | |
// width of restraint bar in the front | |
const bar = 50; | |
// width of the rack's back crosspieces | |
const rear = 100; | |
define('wall', () => { | |
push(); | |
startPath(); | |
penDown(); | |
forward(50); | |
arcRight(90, depth - 50); | |
turn(-90); | |
for (let i = 0; i < shelves; i++) { | |
if (i === 0) { | |
right(shelfheight - (depth - 50) - 100 - bar); | |
} else { | |
right(shelfheight - 100 - bar); | |
} | |
right(U/2); | |
back(U); | |
right(bar - U); | |
forward(U); | |
right(U/2); | |
right(100); | |
} | |
right(U); | |
back(notch); | |
right(rise); | |
back(depth - notch); | |
left(rise + U); | |
push(); | |
for (let i = 0; i < shelves; i++) { | |
left((shelfheight - rear) / 2); | |
left(U); | |
forward(U); | |
left(rear - U * 2); | |
back(U); | |
left(U); | |
left((shelfheight - rear) / 2); | |
} | |
penUp(); | |
pop(); | |
rel(2 * U, -(U * 2)); | |
for (let i = 0; i < shelves; i++) { | |
penDown() | |
forward(depth - U * 4); | |
right(U); | |
back(depth - U * 4); | |
left(U); | |
penUp(); | |
left(shelfheight); | |
} | |
endPath(); | |
pop(); | |
}); | |
for(let i = 0; i < 2; i++) { | |
place('wall', (depth + U) * i, 0, 'start', 'start'); | |
} | |
move((depth + U) * 2, 0); | |
for (let i = 0; i < shelves; i++) { | |
// draw shelf | |
push(); | |
startPath(); | |
right(U); | |
penDown(); | |
forward(U); | |
left(U); | |
forward(width - 2 * U); | |
right(U); | |
forward(U); | |
right(depth - 4 * U); | |
back(U); | |
right(U); | |
back(width - 2 * U); | |
left(U); | |
back(U); | |
left(depth - 4 * U); | |
endPath(); | |
pop(); | |
rel(0, depth - U); | |
// draw guard bar | |
push(); | |
startPath(); | |
right(U/2); | |
penDown(); | |
forward(U); | |
left(U/2); | |
forward(width - 2 * U); | |
right(U/2); | |
forward(U); | |
right(bar - U); | |
back(U); | |
right(U/2); | |
back(width - 2 * U); | |
left(U/2); | |
back(U); | |
left(bar - U); | |
endPath(); | |
pop(); | |
rel(0, bar + U); | |
// draw back crosspiece | |
push(); | |
startPath(); | |
right(U); | |
penDown(); | |
forward(U); | |
left(U); | |
forward(width - 2 * U); | |
right(U); | |
forward(U); | |
right(rear - 2 * U); | |
back(U); | |
right(U); | |
back(width - 2 * U); | |
left(U); | |
back(U); | |
left(rear - 2 * U); | |
endPath(); | |
pop(); | |
rel(0, rear + U); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment