// ============================================================================ // Kidsbox enclosure — helper modules // ============================================================================ // A box with rounded VERTICAL edges only (flat top & bottom for clean FDM). // size = [x, y, z], r = corner radius. module rbox(size, r) { x = size[0]; y = size[1]; z = size[2]; hull() { for (sx = [r, x - r], sy = [r, y - r]) translate([sx, sy, 0]) cylinder(h = z, r = r); } } // Hollow shell: outer rbox minus inner rbox, open at the top (+Z). // Floor thickness `ft`, wall `w`. module shell(size, r, w, ft) { x = size[0]; y = size[1]; z = size[2]; difference() { rbox([x, y, z], r); translate([w, w, ft]) rbox([x - 2*w, y - 2*w, z - ft + 1], max(0.1, r - w)); } } // A screw boss (solid post with a pilot hole) standing in +Z. module boss(od, h, hole_d) { difference() { cylinder(h = h, d = od); translate([0, 0, -0.5]) cylinder(h = h + 1, d = hole_d); } } // A flat ring. module ring(od, id, h) { difference() { cylinder(h = h, d = od); translate([0, 0, -0.5]) cylinder(h = h + 1, d = id); } } // Bolt circle: place children at `count` points on diameter `d`. module bolt_circle(d, count, start = 0) { for (i = [0 : count - 1]) rotate([0, 0, start + i * 360 / count]) translate([d/2, 0, 0]) children(); } // A rounded-rectangle plate (2D) for linear_extrude. module rrect(x, y, r) { hull() for (sx = [r, x - r], sy = [r, y - r]) translate([sx - x/2, sy - y/2]) circle(r = r); }