$fn = 64; // --- Parameters --- unit_height = 20; // Height of a single unit (mm) height_units = 2; // Number of height units for the bin inner_r = 20; // Inner radius of each hex compartment (center to corner) wall = 2; // Wall thickness between compartments floor_thickness = 2; // Thickness of the bottom floor // --- Calculated Variables --- height = unit_height * height_units; apothem = inner_r * cos(30); D = 2 * apothem + wall; // Distance between adjacent hex centers outer_r = inner_r + wall / cos(30); // Outer radius to maintain uniform wall thickness // Module to duplicate geometry across the 19 hex grid positions module hex_positions() { // 1. Center (1 hex) translate([0, 0, 0]) children(); // 2. Inner Ring (6 hexes) for (i = [0 : 5]) { translate([D * cos(i * 60 + 30), D * sin(i * 60 + 30), 0]) children(); } // 3. Outer Ring Corners (6 hexes) for (i = [0 : 5]) { translate([2 * D * cos(i * 60 + 30), 2 * D * sin(i * 60 + 30), 0]) children(); } // 4. Outer Ring Edges (6 hexes) for (i = [0 : 5]) { translate([ D * cos(i * 60 + 30) + D * cos((i + 1) * 60 + 30), D * sin(i * 60 + 30) + D * sin((i + 1) * 60 + 30), 0 ]) children(); } } // --- Main Geometry --- difference() { // Solid outer body (union of overlapping outer hexes forms a ribbed shell) hex_positions() cylinder(r=outer_r, h=height, $fn=6); // Hollow inner compartments (subtracted to create the bin) translate([0, 0, floor_thickness]) hex_positions() cylinder(r=inner_r, h=height + 1, $fn=6); }