summaryrefslogtreecommitdiff
path: root/full_model.scad
blob: 3918d32e0cf64c7b1a5dbf478e55a51e0d0f2863 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
include <parameters.scad>

use <connector_front.scad>
use <hdd.scad>
use <rail.scad>
use <backplane.scad>

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) translate([bar_thickness/2, 0, 0])
    front_connector(
      border_left   = x == 0,
      border_right  = x == num_hdd_x,
      border_top    = y == num_hdd_y - 1,
      border_bottom = y == 0
    );

  // TODO: back connector

  // 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 - rail_thickness, 0, bar_thickness - rail_thickness])
      rail();
    rand_color([0.7, 0.7, 0.7], x, -y) translate([tray_width + rail_thickness, 0, bar_thickness - rail_thickness])
      mirror() rail();

    // backplane (to be inserted into the back connector)
    translate([bar_thickness + backplane_hoffset, hdd_length - hdd_standout,
               bar_thickness + backplane_voffset])
      backplane_populated();
  }
}

// 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);

for (y = [0:num_hdd_y-1])
  translate([-tray_width/4, bar_thickness * 1.5, (y+1) * tray_height - bar_thickness/2])
    rotate([0, 90, 0])
      cylinder(h = (num_hdd_x + 0.5) * tray_width, 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);
contact: Jan Huwald // Impressum