]> www.fi.muni.cz Git - things.git/blob - drill_stand.scad
Holder for servo on a carbon tube
[things.git] / drill_stand.scad
1 include <DroidSans.scad>
2
3 // the holes layout is determined by this variable:
4 // drill bit sizes, row by row.
5 // remember to add these numbers also to numbers.txt
6 // and regenerate DroidSans.scad using make.sh
7 sizes = [
8         [ 1.5, 1.7, 2, 2.2, 2.3, 2.5, 3, 3.2, 3.4, 3.5, 4, ],
9         [ 4.2, 4.5, 4.6, 4.7, 4.8, 4.9, 5, 5.1, 5.2, 5.5, ],
10         [ 5.7, 6, 6.1, 6.2, 6.5, 6.7, 6.8, 7, 7.5, 8, ],
11         [ 8.5, 8.6, 9, 9.5, 9.8, 10, 10.1, 10.4 ],
12 ];
13 sizes_max = 10.4; // the maximum value of the above values
14
15 total_width = 140;
16
17 row_y_offsets = [ // can we calculate this somehow?
18         0,
19         sizes[0][len(sizes[0])-1], 
20         sizes[0][len(sizes[0])-1] + sizes[1][len(sizes[1])-1], 
21         sizes[0][len(sizes[0])-1] + sizes[1][len(sizes[1])-1] + sizes[2][len(sizes[2])-1], 
22         sizes[0][len(sizes[0])-1] + sizes[1][len(sizes[1])-1] + sizes[2][len(sizes[2])-1] + sizes[3][len(sizes[3])-1], 
23 ];
24
25 /*
26 sizes = [ [ 1.5, 4.6 ], [ 6.1, 10.1 ] ];
27 // sizes = [ [ 10, 8 ], [ 9.1, 7 ] ];
28 sizes_max = 10.1;
29 total_width = 28;
30 */
31
32 // spares:
33 // 1.5, 2, 2, 3, 3, 3.5, 4.5, 4.5, 4.8, 5, 5.1, 5.5, 6, 6.5, 7,
34 // 8, 9.5
35
36 diam_tolerance = 0.2; // make the hole diameter this bigger
37 drill_bottom = 1.2; // solid bottom (where the holes end)
38 drill_cone = 1.5; // top of the hole is wider by this
39 angled_height = 7;
40
41 item_height = 8; // height of the first row
42 item_depth = sizes_max + 2*drill_cone + angled_height/sqrt(2); 
43 item_h_step = angled_height/sqrt(2); // other rows increment
44
45 epsilon = 0.01;
46 infty = 100;
47
48 // holder for a single bit
49 module one_slot(diam, width, depth, height) {
50         // precision holes; see
51         // http://hydraraptor.blogspot.cz/2011/02/polyholes.html
52         // for details
53         n = max(round(2 * (diam + diam_tolerance)),3);
54         assign(diam1 = (diam + diam_tolerance) / cos(180/n))
55         difference() {
56                 // object body
57                 translate([0, 0, 0])
58                         cube([width, depth, height]);
59                 // drill hole
60                 translate([width/2, (depth+angled_height/sqrt(2))/2, drill_bottom])
61                         cylinder(r = diam1/2, h = infty, $fn=n);
62                 // top cone
63                 translate([width/2, (depth+angled_height/sqrt(2))/2, height-drill_cone])
64                         cylinder(r1 = diam1/2, r2 = (diam+drill_cone)/2,
65                                 h = drill_cone+epsilon,
66                                 $fn = n);
67                 // angled front side
68                 translate([0, 0, height-angled_height/sqrt(2)])
69                         rotate([-45, 0, 0])
70                         translate([-infty/2, -infty, -infty/2])
71                                 cube(infty);
72                 // text
73                 translate([width/2, 0, height-angled_height/sqrt(2)])
74                         rotate([45, 0, 0])
75                         scale([0.1, 0.1, 0.2])
76                         translate([0, 12, 5-(0.8/0.1)])
77                                 DroidSans(str(diam));
78         };
79 };
80
81 module one_row(row, height) {
82         assign(item_width = total_width/len(row),
83                 depth = row[len(row)-1] + 2*drill_cone + angled_height/sqrt(2))
84         for (i = [0 : len(row)-1])
85                 translate([i*(item_width-epsilon), 0, 0])
86                         one_slot(row[len(row)-1-i], item_width, depth, height);
87 };
88
89 module all_rows(rows) {
90         for (i = [0 : len(rows)-1]) {
91                 translate([0, row_y_offsets[i] + i*(2*drill_cone + angled_height/sqrt(2) - epsilon), 0])
92                         one_row(rows[i],
93                                 item_height+item_h_step*i);
94         };
95 };
96
97 translate([-total_width/2, -len(sizes)*item_depth/2, 0])
98         all_rows(sizes);