$fn = 64; // --- Parameters --- unit_height_mm = 7; // Height of a single unit units_height = 4; // 4-unit height as requested total_height = units_height * unit_height_mm; inner_flat_to_flat = 35; // Inner width of each hexagonal compartment wall_thickness = 1.5; // Thickness of the walls floor_thickness = 1.5; // Thickness of the bottom floor // --- Calculated Values --- F = inner_flat_to_flat; W = wall_thickness; C = F + W; // Center-to-center distance for exact shared walls // Radii for the hexagons (corner-to-corner distance) R_in = F / sqrt(3); R_out = (F + 2 * W) / sqrt(3); // Center coordinates for the 3 hexagons forming an equilateral triangle c1 = [0, C / sqrt(3)]; c2 = [C / 2, -C / (2 * sqrt(3))]; c3 = [-C / 2, -C / (2 * sqrt(3))]; // --- Modules --- module hex_cylinder(r, h) { // Rotated 30 degrees so the flat sides face each other rotate([0, 0, 30]) cylinder(r=r, h=h, $fn=6); } // --- Main Object --- difference() { // Outer body union() { translate([c1[0], c1[1], 0]) hex_cylinder(R_out, total_height); translate([c2[0], c2[1], 0]) hex_cylinder(R_out, total_height); translate([c3[0], c3[1], 0]) hex_cylinder(R_out, total_height); } // Inner compartments (hollowed out) union() { // Z-shifted for floor, height increased slightly to prevent Z-fighting artifacts translate([c1[0], c1[1], floor_thickness]) hex_cylinder(R_in, total_height); translate([c2[0], c2[1], floor_thickness]) hex_cylinder(R_in, total_height); translate([c3[0], c3[1], floor_thickness]) hex_cylinder(R_in, total_height); } }