include use use use use use use module rand_color(base, seed1=0, seed2=0, seed3=0) { c = base + rands(0, 0.2, 3, round(1000000 * sin(0.329045 + 17*seed1 + 23*seed2 + 29*seed3))); color(c) children(); } for (x = [0:num_hdd_x]) for (y = [0:num_hdd_y-1]) translate([bar_thickness/2 + x*tray_width, 0, y*tray_height]) { // front connector rand_color([0.0, 0.8, 0.0], x, y) front_connector( border_left = x == 0, border_right = x == num_hdd_x, border_top = y == num_hdd_y - 1, border_bottom = y == 0 ); // back connector rand_color([0.0, 0.8, 0.0], y, x) translate([0, hdd_length - hdd_standout - bar_thickness, 0]) back_connector( border_left = x == 0, border_right = x == num_hdd_x, border_top = y == num_hdd_y - 1, border_bottom = y == 0 ); // internal elements (that have nothing right of the last hdd column) if (x != num_hdd_x) { // rails rand_color([0.7, 0.7, 0.7], -x, y) translate([bar_thickness/2 - rail_thickness, 0, bar_thickness - rail_thickness]) rail(); rand_color([0.7, 0.7, 0.7], x, -y) translate([tray_width + rail_thickness - bar_thickness/2, 0, bar_thickness - rail_thickness]) mirror() rail(); // backplane (to be inserted into the back connector) translate([backplane_hoffset, hdd_length - hdd_standout, backplane_voffset]) backplane_populated(); } } // back connector pole // TODO: split correctly if size exceeds printing area for (x = [0:num_hdd_x]) assign(border = (x==0 || x==num_hdd_x)) translate([x*tray_width, hdd_length - hdd_standout + (border ? 0 : backplane_thickness), y*tray_height]) connector_pole(num_hdd_y, pole_depth - (border ? 0 : backplane_thickness), cable_funnel = !border); // thread rods for (x = [0:num_hdd_x]) translate([bar_thickness/2 + x * tray_width, bar_thickness/2, -tray_height/2]) cylinder(h = (num_hdd_y + 1) * tray_height, r = rod_diameter/2, $fs=0.1); // vertical front screws for (x = [0:num_hdd_x-1]) for (y = [0:num_hdd_y-1]) translate([(x + 0.5) * tray_width - bar_thickness, bar_thickness * 1.5, (y+1) * tray_height - bar_thickness/2]) rotate([0, 90, 0]) cylinder(h = 3 * bar_thickness, r = rod_diameter/2, $fs=0.1); translate([bar_thickness + floor(num_hdd_x/2) * tray_width, -hdd_standout, bar_thickness + floor(num_hdd_y/2) * tray_height]) color("Blue") hdd(); echo("MODEL INFO: total height = ", num_hdd_y * tray_height); echo("MODEL INFO: total width = ", num_hdd_x * tray_width + bar_thickness);