//////////////// /// Settings /// //////////////// // The thickness of the walls wall_thickness = 2; // The dimensions of the box on the inside box_inside = [ 110, // X 130, // Y 110 // Z ]; screw_diameter = 3; screw_length = 6.3; // ------------------------------------------- box_outside = [ box_inside[0] + (wall_thickness * 2), box_inside[1] + (wall_thickness * 2), box_inside[2] + (wall_thickness - 0.1) ]; // ------------------------------------------- // Misc. Utility functions // ------------------------------------------- module screw_port() { difference() { color("purple") cylinder( h = screw_length + wall_thickness, d = screw_diameter + (wall_thickness * 2), $fn = 25 ); color("mediumpurple") translate([0, 0, wall_thickness + 0.1]) cylinder( h = screw_length, d = screw_diameter, $fn = 25 ); }; } // Box // ------------------------------------------- difference() { color("green") cube(box_outside); translate([wall_thickness, wall_thickness, wall_thickness]) { cube(box_inside); } }; // Screw holes // ------------------------------------------- translate([0, 0, 200]) screw_port(); // Corners // ------------------------------------------- corner_piece_size = screw_diameter + (wall_thickness * 2); module corner_piece() { color("red") difference() { cube([ corner_piece_size, corner_piece_size, box_inside[2] ]); translate([ corner_piece_size / 2, corner_piece_size / 2, box_inside[2] - screw_length + 0.1 ]) cylinder(h = screw_length, d = screw_diameter, $fn = 25); } } translate([ wall_thickness, wall_thickness, wall_thickness ]) corner_piece(); translate([ wall_thickness + box_inside[0] - corner_piece_size, wall_thickness, wall_thickness ]) corner_piece(); translate([ wall_thickness, wall_thickness + box_inside[1] - corner_piece_size, wall_thickness ]) corner_piece(); translate([ wall_thickness + box_inside[0] - corner_piece_size, wall_thickness + box_inside[1] - corner_piece_size, wall_thickness ]) corner_piece();