Files
kidsbox/enclosure/lib.scad
Claude 75dd63b56f Add parametric 3D-printable enclosure (OpenSCAD)
A printable reimagining of the wooden Kidsbox: rectangular cabinet with two
front speakers, removable top lid (NFC tag rests there, reader mounts beneath),
and swappable speaker mounts.

- kidsbox.scad: master model + part dispatcher (body/lid/speaker_adapter/grill)
- params.scad: all tunable dimensions in one place
- lib.scad: helper modules (rounded shell, bosses, bolt circles)
- Fixed front-panel speaker interface + swappable adapter so any driver fits
  by printing a new adapter (edit spk_* params, re-export)
- Internal mounts: 2x18650 cradle, ESP32-LyraT standoffs, RC522 under lid,
  3 buttons on lid, USB/charge + power-switch side ports, back-wall vents
- Snap-in speaker grills
- Makefile to export STLs and render previews (headless via xvfb)
- Exported STLs and preview renders included
- Link enclosure from main README

Dimensions are sensible defaults from the reference photos and common parts;
README flags the fit-critical values to verify before mass-printing.

https://claude.ai/code/session_01MhAnh68DPNnTjcKqjNYDmk
2026-06-13 10:39:55 +00:00

54 lines
1.6 KiB
OpenSCAD

// ============================================================================
// 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);
}