// Assorted modules to be re-used by multiple files // Stuff that's used for tops: module leg(height) { color(COLORSCHEME == "semantic" ? COLOR_SEMANTIC_LOAD_BEARING : COLOR_STEEL) { union() { translate([0, 0, height - LEG_BASE_THICKNESS]){ cylinder(d=LEG_BASE_DIAMETER, h=LEG_BASE_THICKNESS, $fn=8); } cylinder(d=LEG_DIAMETER, h=height, $fn=8); } } } module stand_side() { difference() { color(COLORSCHEME == "semantic" ? COLOR_SEMANTIC_LOAD_BEARING : COLOR_WOOD) { cube([ STAND_DEPTH, STAND_HEIGHT - STAND_THICKNESS, STAND_THICKNESS ]); } // cut out cable slot color(COLORSCHEME == "semantic" ? COLOR_SEMANTIC_CABLE_MANAGEMENT : COLOR_CUTOUT) { translate([ (STAND_DEPTH - CABLE_SLOT_WIDTH) / 2, STAND_HEIGHT - STAND_THICKNESS - CABLE_SLOT_SIDE_OFFSET - CABLE_SLOT_DEPTH, -CUTOUT_OVERCOMMIT ]){ cube([ CABLE_SLOT_WIDTH, CABLE_SLOT_DEPTH, CUTOUT_OVERCOMMIT + STAND_THICKNESS + CUTOUT_OVERCOMMIT ]); } } } } module spacer_cuff() { cylinder(d=LEG_DIAMETER + 2 * SPACER_CUFF_THICKNESS, h=SPACER_CUFF_HEIGHT, $fn=8); } module spacer(length) { // length is not the overall length, but the distance between // the centerpoints of the two legs/feet being connected spacer_cuff_diameter = (LEG_DIAMETER + 2 * SPACER_CUFF_THICKNESS); mid_segment_length = length - spacer_cuff_diameter; color(COLORSCHEME == "semantic" ? COLOR_SEMANTIC_LOAD_BEARING : COLOR_STEEL) { difference() { union() { spacer_cuff(); translate([0, mid_segment_length + spacer_cuff_diameter / 2, SPACER_CUFF_HEIGHT / 2]){ rotate([90, 0, 0]){ cylinder(d=SPACER_THICKNESS, h=mid_segment_length, $fn=8); } } translate([0, length, 0]){ spacer_cuff(); } } cylinder(d=LEG_DIAMETER, h=SPACER_CUFF_HEIGHT, $fn=8); // hole in first cuff translate([0, length, 0]){ cylinder(d=LEG_DIAMETER, h=SPACER_CUFF_HEIGHT, $fn=8); // hole in second cuff } } } } // Stuff that's used for subs: module screw() { color(COLORSCHEME == "semantic" ? COLOR_SEMANTIC_LOAD_BEARING : COLOR_STEEL) { translate([0, 0, MODULE_SCREW_LENGTH]){ cylinder(d=SCREW_HEAD_DIAMETER, h=SCREW_HEAD_THICKNESS, $fn=6); } cylinder(d=SCREW_DIAMETER, h=MODULE_SCREW_LENGTH); } } module screw_hole() { color(COLOR_CUTOUT){ cylinder(d=SCREW_DIAMETER * 1.01, h=MODULE_SCREW_LENGTH + CUTOUT_OVERCOMMIT); } } module barrel_nut() { color(COLORSCHEME == "semantic" ? COLOR_SEMANTIC_LOAD_BEARING : COLOR_STEEL) { difference() { translate([ -MODULE_THICKNESS / 2, // center on origin 0, BARREL_NUT_DIAMETER / 2 // but with the bottom at z=0 ]){ rotate([0, 90, 0]){ cylinder(d=BARREL_NUT_DIAMETER, h=MODULE_THICKNESS); } } cylinder(d=SCREW_DIAMETER, h=BARREL_NUT_DIAMETER); // screw hole } } } module barrel_nut_hole(){ color(COLOR_CUTOUT){ translate([ -MODULE_THICKNESS / 2 - CUTOUT_OVERCOMMIT, // center on origin 0, BARREL_NUT_DIAMETER / 2 // but with the bottom at z=0 ]){ rotate([0, 90, 0]){ cylinder(d=BARREL_NUT_DIAMETER * 1.01, h=CUTOUT_OVERCOMMIT + MODULE_THICKNESS + CUTOUT_OVERCOMMIT); } } } }