$fn = 64; // --- Parameters --- cols = 4; // Number of columns rows = 3; // Number of rows bat_diam = 15.2; // AA battery diameter + clearance bat_depth = 25; // Depth of the slot base = 3; // Base thickness spacing_x = 20; // X spacing between slots spacing_y = 23; // Y spacing between slots (larger to fit labels) wall_x = 5; // Side wall thickness wall_y = 7; // Front/back wall thickness // --- Calculated Dimensions --- width = (cols - 1) * spacing_x + bat_diam + 2 * wall_x; depth = (rows - 1) * spacing_y + bat_diam + 2 * wall_y; height = base + bat_depth; difference() { // Main body block cube([width, depth, height]); // Battery slots and individual labels for (c = [0 : cols - 1]) { for (r = [0 : rows - 1]) { slot_num = r * cols + c + 1; cx = wall_x + bat_diam/2 + c * spacing_x; cy = wall_y + bat_diam/2 + r * spacing_y; // Battery cylindrical cutout translate([cx, cy, base]) cylinder(h = bat_depth + 1, d = bat_diam); // Slot number label (cut 0.6mm into top surface for clean 3D printing) translate([cx, cy - bat_diam/2 - 2.5, height - 0.6]) linear_extrude(1.2) text(str(slot_num), size=4, halign="center", valign="center", font="Arial:style=Bold"); } } // Front label "AA BATTERIES" (cut 0.6mm into front surface) translate([width/2, 0.6, height/2]) rotate([90, 0, 0]) linear_extrude(1.2) text("AA BATTERIES", size=height/3.5, halign="center", valign="center", font="Arial:style=Bold"); }