// dimension of the outer box: *w*idth, dep*t*h, *h*eight, thickness (d), width of the upper slot (wi) d = 2.4; t = 41 + d; w = 18 + 2*d; wi = 13.1; h = 5.1 + d; // dimension of the retainer hole: *w*idth, dep*t*h, *d*istance to edge aw = 8.6; at = 4.1; ad = t - d - 34.6 - at; // curve radius of rounded corners cr = 2; // inclination of ceiling support structure support_fraction = 0.2; module round_corner(r, h) { translate([-r, -r, 0]) difference() { cube([r, r, h]); cylinder(h=h, r=r, $fn=50); } } module side() { w2 = (w-wi)/2; s = support_fraction * (w2 - d); translate([0, t, 0]) rotate([90, 0, 0]) linear_extrude(height = t, convexity=2) polygon([[0,0], [0,h], [w2,h], [w2,h-d+s], [d,h-d], [d,0]]); } module half() { translate([-w/2, 0, 0]) difference() { union() { // base plate cube([w/2, t, d]); // back cube([w/2, d, h]); // sides and top side(); } union() { // retainer hole translate([(w-aw)/2, t-at-ad, 0]) cube([aw/2, at, 2*d]); // round vertical corners translate([0, 0, 0]) rotate(a=180) round_corner(r=cr, h=h); translate([0, t, 0]) rotate(a=90 ) round_corner(r=cr, h=h); // shorten rail at opening translate([d, t-d, h-d]) cube(d); } } } half(); mirror() half();