summaryrefslogtreecommitdiff
path: root/con_bar_v.scad
blob: 79b54294bdc59174cf1498092d0c8d784dddfe5d (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
bar_width = 4;
bar_height = 20;

rod_rad = 5;
rod_bury = 10; // how deep the rod sticks in its retainer

clamp_thick = 5;
clamp_l1 = 10;
clamp_l2 = 50;

strut_height = bar_height;
strut_thick = 3;

angle = 30; // fake value; TODO

clamp_width = 2 * clamp_thick + bar_width;
clamp_height = bar_height + clamp_thick;
clamp_length = clamp_l2 - clamp_l1;

module strut(num, r1, r2, h) {
 a = 360 / num;
 b = a - 90;
 d = clamp_width/2;

 linear_extrude(h) polygon([
   [r1, d], [r2, d],
   [cos(a)*r2 + cos(b)*d, sin(a)*r2 + sin(b)*d],
   [cos(a)*r1 + cos(b)*d, sin(a)*r1 + sin(b)*d]]);
}

module clamp() {
  l = clamp_l2 - clamp_l1;
  r = clamp_thick/2;

  difference() {
    translate([clamp_l1, -clamp_width/2, 0])
    cube([l, clamp_width, clamp_height]);

    translate([0, -bar_width/2, clamp_thick + clamp_l2 * sin(angle)])
    rotate([0, angle, 0])
    cube([2*l, bar_width, 2*bar_height]);

    for (i = [-1, 1])
      translate([0, -i * (clamp_thick + bar_width/2), clamp_height - clamp_thick/2])
      rotate([0, 90, 0])
      # linear_extrude(clamp_length*2)
      polygon([[r,0], [r, i*r], [0, 0]]);
 }
}

module rod_retainer(h) {
  $fs = 0.1;
  difference() {
    union() {
      cylinder(h=h, r=rod_rad + strut_thick);

      translate([0, -strut_thick/2, 0])
      cube([clamp_l1, strut_thick, h]);
    }

    translate([0, 0, max(strut_thick, h - rod_bury)])
    cylinder(h=h, r=rod_rad);
  }
}

module con(num) {
  for (i = [0:num-1])
    rotate(i*360/num) {
      clamp();
      strut(num, clamp_l1, clamp_l1 + strut_thick, strut_height);
      strut(num, clamp_l2, clamp_l2 - strut_height, strut_thick);
      strut(num, clamp_l2, clamp_l2 - strut_thick, strut_height);
    }
  rod_retainer(max(clamp_thick, clamp_length * sin(angle)));
}

con(3);
contact: Jan Huwald // Impressum