/* My vials: 2" high inc cap 1 1/2" w/o cap 1/2" diameter */ // 2540mm = 1 inch // Change to 1 when working in cm or 10 when working in mm i guess scaleFactor = 25.4; vialHeight = scaleFactor * (1 + 1/2); vialDiam = scaleFactor * (1/2); // Padding around the vials. padding = scaleFactor * (1/8); // Height / Width on a 1x1 box. boxHeight = vialHeight + padding; boxWidth = vialDiam + padding; vialRows = 1; vialColumns = 1; for ( vialRow = [0 : vialRows-1] ){ for ( vialColumn = [0 : vialColumns-1] ){ translate([vialRow * boxWidth, vialColumn * boxWidth, 0]) { difference() { cube ([boxWidth, boxWidth, boxHeight]); translate ([boxWidth / 2, boxWidth / 2, boxHeight - vialHeight]) cylinder (h = vialHeight, d=vialDiam, $fn=100); } } } }