$fn=64; // --- Parameters --- height_units = 4; // Number of height units unit_height = 7; // Height of a single unit in mm (7mm is common for modular bins) center_distance = 30; // Distance between centers of adjacent hexagons wall_thickness = 1.6; // Thickness of the compartment walls floor_thickness = 1.6; // Thickness of the bottom floor // --- Calculated Variables --- total_height = height_units * unit_height; // Calculate outer and inner circumradii to maintain exactly constant wall thickness // Formula derives from Inradius = Circumradius * sqrt(3)/2 R_out = (center_distance + wall_thickness) / sqrt(3); R_in = (center_distance - wall_thickness) / sqrt(3); // --- Modules --- module hex_cluster(r, h) { union() { // Center hexagon cylinder(r=r, h=h, $fn=6); // 6 Surrounding hexagons for(i = [0 : 5]) { rotate([0, 0, i * 60]) translate([center_distance, 0, 0]) cylinder(r=r, h=h, $fn=6); } } } // --- Main Geometry --- difference() { // Outer solid cluster shell hex_cluster(R_out, total_height); // Hollow out the 7 compartments // Translated up by floor_thickness, and made slightly taller to prevent Z-fighting translate([0, 0, floor_thickness]) hex_cluster(R_in, total_height + 1); }