$fn = 64; // --- Parameters --- unit_height = 20; // Overall height of the bin (1 unit) hex_radius = 20; // Outer radius (center to point) of each hexagon cell wall_thickness = 1.5; // Thickness of the outer walls floor_thickness = 1.5; // Thickness of the solid bottom floor // --- Derived Parameters --- // Distance between centers of adjacent hexagons to touch flat-to-flat center_dist = sqrt(3) * hex_radius; // Inner radius calculated to maintain exact outer wall thickness inner_radius = hex_radius - (wall_thickness / cos(30)); // Module to generate a single hexagon properly oriented module hex_prism(r, h) { rotate([0, 0, 30]) cylinder(r=r, h=h, $fn=6); } // Module to position children at the 3 hexagon centers module hex_positions() { translate([0, 0, 0]) children(); translate([center_dist, 0, 0]) children(); translate([center_dist / 2, 1.5 * hex_radius, 0]) children(); } // Main bin generation module triangle_3hex_bin() { // Center the entire bin around the origin translate([-center_dist / 2, -0.75 * hex_radius, 0]) { difference() { // Outer triangular shape (hull of 3 outer hexagons) hull() { hex_positions() hex_prism(hex_radius, unit_height); } // Inner hexagonal compartments (subtracted) hex_positions() { // Translate up by floor_thickness and extend slightly past top to prevent Z-fighting translate([0, 0, floor_thickness]) hex_prism(inner_radius, unit_height + 1); } } } } // Render the model triangle_3hex_bin();