]> www.fi.muni.cz Git - things.git/blob - skrturbo-holder.scad
switch holder.scad
[things.git] / skrturbo-holder.scad
1 eps = 0.01;
2
3 board_screw_w = 101.85;
4 board_screw_h = 76.3;
5 board_zoff = 10;
6 board_screw_supp = 3;
7 board_screw_d = 2.5;
8 board_sep = 5; // realne je 4 mm na kazdou stranu
9 board_sep2 = 14; // na strane kabelu vic mista
10 thin_wall = 1.5;
11 box_z = 40;
12 box_w = board_screw_w + board_sep + board_sep2 + 2*thin_wall;
13 box_h = board_screw_h + 2*board_sep + 2*thin_wall;
14
15 screw_support_in = 5;
16
17 clip_w = 14;
18 clip_h = 4;
19 screw_d = 5;
20 screw_head_d = 10;
21
22 x_cable_xoff = 35;
23 cable_ext = 8;
24 cable_wall = 2;
25 cable_top = 6;
26 cable_d = 10;
27 nylon_d = 3;
28
29 y_cable_yoff = 70;
30 y_cable_rot = 60;
31 y_cable_xoff = box_w + 3;
32
33 cable_back = 20; // keep space for rotating it
34
35 module extrusion_clip(width, thick) {
36         difference() {
37                 union() {
38                         cube([20, width, thick]);
39                         hull() {
40                                 translate([6, 0, 0]) cube([8, width, thick]);
41                                 translate([7, 0, 0]) cube([6, width, thick+1.5]);
42                         }
43                 }
44                 translate([10, width/2, -eps])
45                         cylinder(r = screw_d/2, h = thick+1.5+2*eps, $fn = 6);
46         }
47 }
48
49 module cable_inlet() {
50         hull() {
51                 translate([-cable_d/2, -cable_back, 0])
52                         cube([cable_d/2, cable_back*0.8, box_z]);
53                 translate([-cable_d/2-cable_top, -cable_back,
54                         box_z - cable_wall - cable_d])
55                         cube([cable_d + 2*cable_top, cable_back+cable_ext,
56                                 cable_d+cable_wall]);
57         }
58 }
59
60 module cable_inlet_hole() {
61         translate([-cable_d/2, -cable_back-eps, box_z-cable_d])
62                 cube([cable_d, cable_back + cable_ext + 2*eps, cable_d+eps]);
63         translate([0, -cable_back-eps, box_z-cable_d-cable_wall - nylon_d/2])
64                 rotate([-90, 0, 0])
65                 cylinder(r = nylon_d/2, h = cable_ext + cable_back + 2*eps,
66                         $fn = 6);
67         for (x = [-1, 1]) scale([x, 1, 1])
68         translate([cable_d/2 + cable_top/2, cable_ext/2, box_z - cable_d])
69                 rotate([0, 0, 90])
70                 cylinder(r = board_screw_d/2, h = cable_d + eps, $fn = 6);
71 }
72
73 difference() {
74         union() {
75                 cube([box_w, box_h, box_z]);
76                 translate([-20, 0, 0]) extrusion_clip(clip_w, clip_h);
77                 translate([clip_h, box_h, clip_h])
78                 rotate([0, -90, 0]) extrusion_clip(clip_w, clip_h);
79                 // side beam
80                 hull() {
81                         translate([eps, 0, 6+clip_h]) cube([eps, box_h, 8]);
82                         translate([-1.5, 0, 7+clip_h]) cube([1.5, box_h, 6]);
83                 }
84
85                 // top strut
86                 hull() {
87                         translate([0, box_h, 0]) cube([clip_h, clip_w, clip_h]);
88                         translate([box_w-eps, box_h, 0]) cube([eps, eps, clip_h]);
89                 }
90                 // x cable
91                 translate([x_cable_xoff, box_h, 0])
92                         cable_inlet();
93                 // y cable
94                 translate([y_cable_xoff, y_cable_yoff, 0])
95                         rotate([0, 0, -y_cable_rot])
96                         cable_inlet();
97         }
98
99         // board base
100         translate([thin_wall, thin_wall, board_zoff])
101                 cube([box_w - 2*thin_wall, box_h - 2*thin_wall, box_z]);
102         // board screw supports
103         translate([thin_wall, thin_wall+board_sep+screw_support_in,
104                 board_zoff - board_screw_supp])
105                 cube([box_w - 2*thin_wall,
106                         board_screw_h - 2*screw_support_in, box_z]);
107         translate([thin_wall+board_sep+screw_support_in, thin_wall,
108                 board_zoff - board_screw_supp])
109                 cube([board_screw_w - 2*screw_support_in,
110                         box_h - 2*thin_wall, box_z]);
111         // inner hole
112         translate([thin_wall+board_sep+screw_support_in,
113                 thin_wall+board_sep+screw_support_in, thin_wall])
114                 cube([board_screw_w - 2*screw_support_in,
115                         board_screw_h - 2*screw_support_in, box_z]);
116
117         // ribs in the back side
118         let (
119                 hole_min_w = 4,
120                 rib_w = 2,
121                 holes = floor((board_screw_w - 2*screw_support_in + rib_w)/(hole_min_w+rib_w)),
122                 hole_w = (board_screw_w - 2*screw_support_in + rib_w)/holes - rib_w
123         )
124         for (i = [0:1:holes-1]) {
125                 translate([thin_wall+board_sep+screw_support_in
126                                 + i*(hole_w+rib_w), thin_wall+board_sep+screw_support_in, -eps])
127                         cube([hole_w, box_h-2*board_sep-2*thin_wall-2*screw_support_in, thin_wall+2*eps]);
128         }
129         // holes in the bottom side
130         let (
131                 hole_min_w = 10,
132                 rib_w = 8,
133                 hole_zoff = 15,
134                 hole_h = 15,
135                 holes = floor((box_w - 6*thin_wall)/(hole_min_w+rib_w)),
136                 hole_w = (box_w - 6*thin_wall + rib_w)/holes - rib_w
137         )
138         for (i = [0:1:holes-1]) {
139                 translate([3*thin_wall + i*(hole_w+rib_w), -eps, hole_zoff])
140                         cube([hole_w, thin_wall + 2*eps, hole_h]);
141         }
142
143         // screw holes
144         for (x = [0, 1]) for (y = [0, 1])
145                 translate([thin_wall+board_sep + x*board_screw_w,
146                         thin_wall+board_sep + y*board_screw_h,
147                         thin_wall])
148                 cylinder(r = board_screw_d/2, h = box_z, $fn = 6);
149
150         // usb slot
151         translate([thin_wall + board_sep + 69.5, box_h - thin_wall - eps,
152                 board_zoff + 1])
153                 cube([14, thin_wall+2*eps, 11]); 
154         // microsd slot
155         translate([thin_wall + board_sep + 48, box_h - thin_wall - eps,
156                 board_zoff + 1])
157                 cube([16, thin_wall+2*eps, 4]); 
158         // x cable hole
159         translate([x_cable_xoff, box_h, 0])
160                 cable_inlet_hole();
161
162         // y cable hole
163         translate([y_cable_xoff, y_cable_yoff, 0])
164                 rotate([0, 0, -y_cable_rot])
165                 cable_inlet_hole();
166 }
167