added functions and fixes to gridbeam.scad

This commit is contained in:
Timothy Schmidt 2011-01-05 17:42:10 -05:00
parent caa0765cea
commit 32fdce5eb5

View file

@ -8,7 +8,10 @@
// zBeam(segments) - create a vertical gridbeam strut 'segments' long // zBeam(segments) - create a vertical gridbeam strut 'segments' long
// xBeam(segments) - create a horizontal gridbeam strut along the X axis // xBeam(segments) - create a horizontal gridbeam strut along the X axis
// yBeam(segments) - create a horizontal gridbeam strut along the Y axis // yBeam(segments) - create a horizontal gridbeam strut along the Y axis
// shelf(width, height) - create a shelf suitable for use in gridbeam structures width and height in 'segments' // topShelf(width, depth, corners) - create a shelf suitable for use in gridbeam structures width and depth in 'segments', corners == 1 notches corners
// bottomShelf(width, depth, corners) - like topShelf, but aligns shelf to underside of beams
// backBoard(width, height, corners) - create a backing board suitable for use in gridbeam structures width and height in 'segments', corners == 1 notches corners
// frontBoard(width, height, corners) - like backBoard, but aligns board to front side of beams
// translateBeam([x, y, z]) - translate gridbeam struts or shelves in X, Y, or Z axes in units 'segments' // translateBeam([x, y, z]) - translate gridbeam struts or shelves in X, Y, or Z axes in units 'segments'
include <units.scad> include <units.scad>
@ -56,9 +59,11 @@ module translateBeam(v) {
} }
} }
module shelf(width, depth) { module topShelf(width, depth, corners) {
difference() { difference() {
cube([width * $beam_width, depth * $beam_width, $beam_shelf_thickness]); cube([width * $beam_width, depth * $beam_width, $beam_shelf_thickness]);
if (corners == 1) {
translate([-1, -1, -1]) translate([-1, -1, -1])
cube([$beam_width + 2, $beam_width + 2, $beam_shelf_thickness + 2]); cube([$beam_width + 2, $beam_width + 2, $beam_shelf_thickness + 2]);
translate([-1, (depth - 1) * $beam_width, -1]) translate([-1, (depth - 1) * $beam_width, -1])
@ -67,5 +72,34 @@ module shelf(width, depth) {
cube([$beam_width + 2, $beam_width + 2, $beam_shelf_thickness + 2]); cube([$beam_width + 2, $beam_width + 2, $beam_shelf_thickness + 2]);
translate([(width - 1) * $beam_width, (depth - 1) * $beam_width, -1]) translate([(width - 1) * $beam_width, (depth - 1) * $beam_width, -1])
cube([$beam_width + 2, $beam_width + 2, $beam_shelf_thickness + 2]); cube([$beam_width + 2, $beam_width + 2, $beam_shelf_thickness + 2]);
}
} }
}
module bottomShelf(width, depth, corners) {
translate([0,0,-$beam_shelf_thickness])
topShelf(width, depth, corners);
}
module backBoard(width, height, corners) {
translate([$beam_width, 0, 0])
difference() {
cube([$beam_shelf_thickness, width * $beam_width, height * $beam_width]);
if (corners == 1) {
translate([-1, -1, -1])
cube([$beam_shelf_thickness + 2, $beam_width + 2, $beam_width + 2]);
translate([-1, -1, (height - 1) * $beam_width])
cube([$beam_shelf_thickness + 2, $beam_width + 2, $beam_width + 2]);
translate([-1, (width - 1) * $beam_width, -1])
cube([$beam_shelf_thickness + 2, $beam_width + 2, $beam_width + 2]);
translate([-1, (width - 1) * $beam_width, (height - 1) * $beam_width])
cube([$beam_shelf_thickness + 2, $beam_width + 2, $beam_width + 2]);
}
}
}
module frontBoard(width, height, corners) {
translate([-$beam_width - $beam_shelf_thickness, 0, 0])
backBoard(width, height, corners);
} }