$fn = 64; // --- Parameters --- // Number of rings (2 rings = 1 center + 6 + 12 = 19 hexes total) rings = 2; // Flat-to-flat inner dimension of each hex pocket (mm) hex_size = 40; // Thickness of the walls between hex pockets (mm) wall_thickness = 2; // Thickness of the solid bottom base layer (mm) base_thickness = 2; // Height of the hexagonal walls (mm) rim_height = 8; // Diameter of the mounting hole in the center of each hex (set to 0 to disable) screw_hole_diameter = 4; // --- Calculated Values --- total_height = base_thickness + rim_height; // Center-to-center distance to maintain exact wall thickness D = hex_size + wall_thickness; // Outer radius (center to corner) with a 0.05mm overlap to ensure a manifold 3D-printable mesh R_outer = D / sqrt(3) + 0.05; // Inner radius (center to corner) for the pocket cutouts R_inner = hex_size / sqrt(3); // --- Geometry --- difference() { // Main baseplate body (union of overlapping outer hexes) union() { for (q = [-rings : rings]) { for (r = [max(-rings, -q - rings) : min(rings, -q + rings)]) { // Hexagonal grid basis vectors x = D * q + D/2 * r; y = D * sqrt(3)/2 * r; translate([x, y, 0]) rotate([0, 0, 30]) cylinder(r = R_outer, h = total_height, $fn=6); } } } // Pockets and screw holes to subtract for (q = [-rings : rings]) { for (r = [max(-rings, -q - rings) : min(rings, -q + rings)]) { x = D * q + D/2 * r; y = D * sqrt(3)/2 * r; translate([x, y, 0]) { // Hexagonal pocket cutout (shifted up by base_thickness, +1 for clean cut) translate([0, 0, base_thickness]) rotate([0, 0, 30]) cylinder(r = R_inner, h = rim_height + 1, $fn=6); // Center mounting hole if (screw_hole_diameter > 0) { translate([0, 0, -1]) cylinder(d = screw_hole_diameter, h = base_thickness + 2); } } } } }