include include // e - electronics // w - wago // this box will have 2 compartments - Electronics and Wago. e_d = 110; w_d = 80; w = 65; h = 40; div_h = 30; t = 2; thicker_wall_t = 7; screw_hole_t = 2.5; screw_spec = "M2.5,3"; $fn = 36*5; // helpers out_d = e_d+w_d+3*t; out_w = w+2*t; corners = [ [-out_w/2, 2*t, -out_d/2, 3*t, 8], [-out_w/2, 2*t, out_d/2, -3*t, 8], [out_w/2, -2*t, -out_d/2, 3*t, 8], [out_w/2, -2*t, out_d/2, -3*t, 8], [out_w/2, -2*t, -out_d/2+e_d + 3*t, 0, 8], [-out_w/2, 2*t, -out_d/2+e_d + 3*t, 0, 8] ]; module cable_cutout(cable_d,h,l, screw_d, screw_l, s_spec) { // hole down(h) yrot(90) cyl(h=l,d=cable_d); // vertical from hole down(h-h*3/8) fwd(cable_d/2 - 0.25) cuboid([l,0.5,h*3/4]); down(h-h*3/8) back(cable_d/2 - 0.25) cuboid([l,0.5,h*3/4]); // horizontal down(h/4) fwd(cable_d/2 + screw_l/2 - 0.5) cuboid([l,screw_l,0.5]); down(h/4) back(cable_d/2 + screw_l/2 - 0.5) cuboid([l,screw_l,0.5]); // vertical at the top fwd(cable_d/2 + screw_l - 0.5) cuboid([l,0.5,h/2 + 0.5]); back(cable_d/2 + screw_l - 0.5) cuboid([l,0.5,h/2 + 0.5]); // hole for screw heads fwd(cable_d/2 + screw_l/2) screw_hole(s_spec, head="flat", anchor="top"); back(cable_d/2 + screw_l/2) screw_hole(s_spec, head="flat", anchor="top"); // hole for screws fwd(cable_d/2 + screw_l/2) down(h/2) cyl(d=2, h=h); back(cable_d/2 + screw_l/2) down(h/2) cyl(d=2, h=h); } // box difference() { union() { // box difference() { cuboid([out_w, out_d, h], chamfer=2, edges=[BOTTOM,"Z"]); up(t) cuboid([w, e_d+w_d+t, h], chamfer=2); } // divider fwd(out_d/2) back(w_d) down(h/2-div_h/2 - t) cuboid([w+t, t, div_h]); // supports for screw holes for(i = corners) { fwd(i[2] + i[3]) left(i[0]+i[1]) up(h/2 - h/12) chain_hull() { cyl(h=h/6, d=i[4]); translate([i[1]/2,i[3]/2,-h/3]) cyl(); } } // thicker wall left(w/2 - thicker_wall_t/2) cuboid([thicker_wall_t, out_d-2*t, h]); } // places for screws for(i = corners) { fwd(i[2] + i[3]) left(i[0]+i[1]) up(h/2 - h/12) cyl(h=h/6, d=screw_hole_t); } // cutouts for cables up(h/2) left(w/2 - thicker_wall_t/2 + t/2) union() { back(10) cable_cutout(5,10,20,4,8, screw_spec); fwd(38) cable_cutout(7,10,20,4,8, screw_spec); fwd(65) cable_cutout(7,10,20,4,8, screw_spec); } } // lid left(w*2) up(h/2 + 4*t) difference() { // lid union() { cuboid([out_w, out_d, t*2], chamfer=1); // down(t) cuboid([w, e_d+w_d+t, t*2], chamfer=2); } // holes for screws for(i = corners) { fwd(i[2]+i[3]) left(i[0]+i[1]) up(t) union() { screw_hole(screw_spec, head="flat", anchor="top"); cyl(d=2,h=10); } } }