$fn = 36; part = "closed"; il=80; iw=50; ih=30; wall=2.4; ox=il+2*wall; oy=iw+2*wall; oz=ih+2*wall+2; module rounded_xy(s,r){ linear_extrude(s[2],center=true) offset(r=r) square([s[0]-2*r,s[1]-2*r],center=true); } module base() { color("#6a6054") difference() { translate([0,0,(ih+wall)/2]) rounded_xy([ox,oy,ih+wall], 4); translate([0,0,(ih+wall)/2+wall]) rounded_xy([il,iw,ih+wall], 2.5); // gasket groove on rim translate([0,0,ih+wall-0.6]) difference() { rounded_xy([il+2.2,iw+2.2,1.2], 2); rounded_xy([il-2.2,iw-2.2,2], 1.5); } } // ribs color("#6a6054") for (x=[-ox/2+8:8:ox/2-8]) translate([x,0, (ih+wall)/2]) cube([1.6, oy+3.2, ih+wall-2], center=true); } module lid() { color("#8a8074") { translate([0,0,1.2]) rounded_xy([ox,oy,2.4], 4); // lip translate([0,0,-1.2]) difference() { rounded_xy([il-0.4, iw-0.4, 3], 2); rounded_xy([il-4, iw-4, 4], 1.4); } // latches for (s=[-1,1]) translate([s*(ox/2-2), 0, -1]) cube([6, 14, 8], center=true); } } if (part=="open") { base(); translate([0, oy+10, 8]) lid(); } else { base(); translate([0,0,ih+wall+1.2]) lid(); }