]> www.fi.muni.cz Git - things.git/blob - wing-tube-joint.scad
switch holder.scad
[things.git] / wing-tube-joint.scad
1 eps = 0.01;
2 infty = 200;
3
4 wall = 1.5;
5 thin_wall = 0.8;
6
7 tube_d = 8.0 + 0.2;
8 base_w = 65;
9 base_l = 30;
10
11 tube_zoff = 3;
12
13 base_w = 65;
14 base_l = 30;
15
16 tube_l = base_l;
17 base_overhang = 0.9; // factor of base_w, base_l
18
19 tube_zoff = 2;
20
21 module polyhole(r1, h1, fn) {
22     rotate([0,0,180])
23         cylinder(h = h1, r = r1 / cos (180 / fn), $fn = fn);
24 }
25
26 module body(tube_zoff) {
27         // base
28         // scale([1, base_l/base_w, 1])
29         // cylinder(r = base_w/2, h = thin_wall);
30         translate([-base_w/2, -base_l/2, 0]) cube([base_w, base_l, thin_wall]);
31
32         // diagonal supports
33         for (x = [-1,1])
34         for (y = [-1,1]) 
35         scale([x, y, 1])  hull() {
36                 translate([base_overhang*base_w/2-thin_wall/2, base_overhang*base_l/2-thin_wall/2, 0])
37                         cylinder(r = thin_wall/2, h = thin_wall, $fn = 16);
38                 translate([0, -tube_l/3+thin_wall/2, 0])
39                         cylinder(r = thin_wall/2, h = tube_zoff + tube_d, $fn = 16);
40         }
41
42         // side supports
43         for (x = [-1,1])
44         for (y = [-1,1]) 
45         scale([x, y, 1])  hull() {
46                 translate([base_overhang*base_w/2-thin_wall/2, base_overhang*base_l/2-thin_wall/2, 0])
47                         cylinder(r = thin_wall/2, h = thin_wall, $fn = 16);
48                 translate([0, tube_l/2-thin_wall/2, 0])
49                         cylinder(r = thin_wall/2, h = tube_zoff + tube_d, $fn = 16);
50         }
51
52         // under the tube supports
53         for (y = [-1,1]) 
54         scale([1, y, 1])  hull() {
55                 translate([0, base_overhang*base_l/2, 0])
56                         cylinder(r = thin_wall/2, h = thin_wall, $fn = 16);
57                 translate([-thin_wall/2, 0, 0])
58                         cube([thin_wall, tube_l/2, tube_zoff]);
59         }
60
61         // side bottom tube supports
62         for (x = [-1,1])
63         scale([x, 1, 1]) {
64                 translate([tube_d/2, -tube_l/2, 0])
65                         cube([wall, tube_l, tube_zoff + tube_d/2]);
66                 translate([tube_d/2+wall, -wall, 0])
67                         cube([wall, 2*wall, tube_zoff + tube_d/2]);
68         }
69
70         // upper cylinder clip
71         translate([0, -tube_l/2, tube_d/2 + tube_zoff])
72         intersection() {
73                 rotate([-90, 0, 0]) union() {
74                         cylinder(r = tube_d/2 + wall, h = tube_l, $fn = 16);
75                         translate([0, 0, tube_l/2 - wall])
76                                 cylinder(r = tube_d/2 + 2*wall,
77                                         h = 2*wall);
78                 }
79                 translate([-tube_d/2-2*wall, 0, 0])
80                         cube([tube_d + 4*wall, tube_l, tube_d]);
81         }
82 }
83
84 module wing_tube_support(tube_zoff) {
85         difference() {
86                 body(tube_zoff);
87                 // main tube
88                 translate([0, -base_l/2-eps, tube_d/2+tube_zoff])
89                 rotate([-90, 0, 0])
90                         polyhole(tube_d/2, base_l + 2*eps, 6);
91                         // cylinder(r = tube_d/2, h = base_l + 2*eps, $fn = 6);
92                 // upper clip
93                 translate([-infty/2, -infty/2, tube_zoff + tube_d + wall])
94                         cube(infty);
95         }
96 }
97
98 wing_tube_support(tube_zoff);