$fn = 64; // --- PARAMETERS --- // Flat-to-flat inner size of a single hex cell (mm) cell_inner_size = 25; // Thickness of the divider walls (mm) wall_thickness = 1.2; // Total height of the divider (mm) height = 30; // Outer clearance to ensure it fits easily inside the bin (mm) clearance = 0.5; // --- CALCULATIONS --- // Distance between centers of adjacent cells center_pitch = cell_inner_size + wall_thickness; // Radius to the points of the theoretical hex grid nominal_radius = center_pitch / sqrt(3); // Radius of the inner cutouts cell_radius = cell_inner_size / sqrt(3); // Offset needed to achieve the correct outer wall thickness minus clearance outer_offset = (wall_thickness / 2) - clearance; // --- MODULES --- // Generates the 19 hex center positions (1 center + 6 inner ring + 12 outer ring) module hex_centers() { for (q = [-2 : 2]) { for (r = [-2 : 2]) { if (abs(q + r) <= 2) { // Pointy-topped hex grid math x = q * 1.5 * nominal_radius; y = (r + q/2) * sqrt(3) * nominal_radius; translate([x, y]) children(); } } } } // --- MAIN MODEL --- linear_extrude(height) { difference() { // Outer profile: perfectly merged 19-hex shape, offset for wall thickness and clearance offset(delta = outer_offset, join_type="miter") { hex_centers() { // Small overlap added to ensure a manifold 2D union circle(r = nominal_radius + 0.01, $fn = 6); } } // Inner cutouts: exactly sized for the 19 individual cells hex_centers() { circle(r = cell_radius, $fn = 6); } } }