From 43810eaba0ab8e4cafc1f3811c3be28708f63c14 Mon Sep 17 00:00:00 2001 From: Eli Mallon Date: Tue, 12 May 2026 17:13:51 -0700 Subject: [PATCH] v4: round the cube's vertical edges (corner_r=4) Replace the rectangular cube/wall constructions for the bottom and top shells with `linear_extrude` of a rounded 2D footprint. Outer envelope and interior cavity share the same radius so wall thickness stays uniform (~2 mm) including at the corner diagonals. Seam ledge, lip, and channel ribs are clipped to the rounded outer envelope so they don't protrude past the rounded vertical faces. Co-Authored-By: Claude Opus 4.7 (1M context) --- cube.scad | 82 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/cube.scad b/cube.scad index 29fc82c..a36698d 100644 --- a/cube.scad +++ b/cube.scad @@ -27,6 +27,10 @@ wall = 2.0; lid_h = 22.5; split_z = H - lid_h; // bottom shell height (= 92.5) +// Corner-rounding radius for the cube's four vertical edges. Outer envelope +// and interior cavity both get the same radius so wall thickness stays uniform. +corner_r = 4.0; + // ---- snap lip (3-sided: left, right, back; no front) ---- lip_h = 6.0; lip_thick = 1.6; @@ -123,6 +127,18 @@ module hollow_box(z0, z1, t = wall) { } } +// 2D rounded rectangle, W × D footprint, vertical edges rounded with `corner_r` +module rounded_outer_2d() { + offset(r = corner_r) offset(r = -corner_r) square([W, D]); +} + +// 2D footprint of the interior cavity — same rounding so wall thickness stays +// `wall` everywhere (including the diagonal at each corner). +module rounded_inner_2d() { + offset(r = corner_r) offset(r = -corner_r) + translate([wall, wall]) square([W - 2*wall, D - 2*wall]); +} + // 3-sided seam ledge — full 4-sided ring with the front strip cut out module seam_ledge_3sided() { difference() { @@ -196,41 +212,49 @@ module back_port_cuts() { // ============================================================ module bottom_shell() { - difference() { - union() { - // 4 outer walls — left/right/back full height, front partial (frame under panel) - translate([0, 0, wall]) cube([wall, D, split_z - wall]); - translate([W - wall, 0, wall]) cube([wall, D, split_z - wall]); - translate([wall, D - wall, wall]) cube([W - 2*wall, wall, split_z - wall]); - // front frame wall — only up to panel bottom - translate([wall, 0, wall]) - cube([W - 2*wall, wall, front_frame_h - wall]); - - // floor - cube([W, D, wall]); - - // 3-sided seam ledge + lip - seam_ledge_3sided(); - lip_ring_3sided(); - - // front channel ribs (grooves for the front panel) - left_front_rib(); - right_front_rib(); - - // snap bumps on the lip (3 of them) - for (p = bump_positions) - translate(p) sphere(d = snap_d); + union() { + // Solid outer envelope (z=[0, split_z]) with rounded vertical edges, + // minus the interior cavity, the front opening above the frame wall, + // and the back-wall power-port cutout. + difference() { + linear_extrude(split_z) rounded_outer_2d(); + // Hollow interior (above floor) + translate([0, 0, wall]) + linear_extrude(split_z - wall + 0.01) rounded_inner_2d(); + // Front opening — only above the frame wall (z >= front_frame_h) + translate([wall, -0.5, front_frame_h]) + cube([W - 2*wall, wall + 1, split_z - front_frame_h + 0.01]); + back_port_cuts(); + } + + // Interior features (seam ledge / lip / ribs) — clipped to the rounded + // envelope so they don't square off the corners where they would otherwise + // protrude past the outer face. + intersection() { + union() { + seam_ledge_3sided(); + lip_ring_3sided(); + left_front_rib(); + right_front_rib(); + } + linear_extrude(split_z + lip_h + 1) rounded_outer_2d(); } - back_port_cuts(); + + // Snap bumps (positioned safely inside the envelope, no clip needed) + for (p = bump_positions) + translate(p) sphere(d = snap_d); } } module top_shell() { difference() { - union() { - hollow_box(split_z, H); - translate([0, 0, H - wall]) cube([W, D, wall]); // ceiling - } + // Rounded outer envelope from z=split_z to z=H + translate([0, 0, split_z]) + linear_extrude(H - split_z) rounded_outer_2d(); + // Hollow interior, stopping `wall` below H to leave a ceiling + translate([0, 0, split_z]) + linear_extrude(H - split_z - wall + 0.01) rounded_inner_2d(); + // Snap dimples (recessed into the inner wall surface) for (p = dimple_positions) translate(p) sphere(d = dimple_d); } -- 2.51.2