$fn = 40; part = "assembly"; pitch = 42; wall = 2.0; bins_x = 3; bins_y = 3; plate_x = bins_x*pitch + 2*wall; plate_y = bins_y*pitch + 2*wall; th = wall + 2.4; bin_outer = pitch - 0.4; bin_h = 28; module rounded_xy(s, r) { linear_extrude(height=s[2], center=true) offset(r=r) square([s[0]-2*r, s[1]-2*r], center=true); } module plate() { color("#8a7a68") difference() { translate([0,0,th/2]) rounded_xy([plate_x, plate_y, th], 3); for (ix=[0:bins_x-1], iy=[0:bins_y-1]) { cx = -plate_x/2 + wall + pitch/2 + ix*pitch; cy = -plate_y/2 + wall + pitch/2 + iy*pitch; translate([cx, cy, th]) cube([bin_outer+0.2, bin_outer+0.2, 1.2], center=true); translate([cx, cy, 1.05]) cylinder(d=6.1, h=2.2, center=true); } } color("#8a7a68") translate([0,0,th+0.8]) difference() { rounded_xy([plate_x-1.2, plate_y-1.2, 1.6], 2); rounded_xy([plate_x-4.4, plate_y-4.4, 2.2], 1.6); } } module bin() { color("#c4b49a") difference() { translate([0,0,bin_h/2]) rounded_xy([bin_outer, bin_outer, bin_h], 2); translate([0,0,bin_h/2+wall]) rounded_xy([bin_outer-2*wall, bin_outer-2*wall, bin_h], 1.4); } } if (part == "plate") plate(); else if (part == "bin") bin(); else { plate(); for (ix=[0:bins_x-1], iy=[0:bins_y-1]) { cx = -plate_x/2 + wall + pitch/2 + ix*pitch; cy = -plate_y/2 + wall + pitch/2 + iy*pitch; translate([cx, cy, th-0.4]) bin(); } }