--- /dev/null
+include <DroidSans.scad>
+
+// the holes layout is determined by this variable:
+// drill bit sizes, row by row.
+// remember to add these numbers also to numbers.txt
+// and regenerate DroidSans.scad using make.sh
+sizes = [
+ [ 1.5, 1.7, 2, 2.2, 2.3, 2.5, 3, 3.2, 3.4, 3.5, 4, ],
+ [ 4.2, 4.5, 4.6, 4.7, 4.8, 4.9, 5, 5.1, 5.2, 5.5, ],
+ [ 5.7, 6, 6.1, 6.2, 6.5, 6.7, 6.8, 7, 7.5, 8, ],
+ [ 8.5, 8.6, 9, 9.5, 9.8, 10, 10.1, 10.4 ],
+];
+sizes_max = 10.4; // the maximum value of the above values
+
+total_width = 140;
+
+row_y_offsets = [ // can we calculate this somehow?
+ 0,
+ sizes[0][len(sizes[0])-1],
+ sizes[0][len(sizes[0])-1] + sizes[1][len(sizes[1])-1],
+ sizes[0][len(sizes[0])-1] + sizes[1][len(sizes[1])-1] + sizes[2][len(sizes[2])-1],
+ sizes[0][len(sizes[0])-1] + sizes[1][len(sizes[1])-1] + sizes[2][len(sizes[2])-1] + sizes[3][len(sizes[3])-1],
+];
+
+/*
+sizes = [ [ 1.5, 4.6 ], [ 6.1, 10.1 ] ];
+// sizes = [ [ 10, 8 ], [ 9.1, 7 ] ];
+sizes_max = 10.1;
+total_width = 28;
+*/
+
+// spares:
+// 1.5, 2, 2, 3, 3, 3.5, 4.5, 4.5, 4.8, 5, 5.1, 5.5, 6, 6.5, 7,
+// 8, 9.5
+
+diam_tolerance = 0.2; // make the hole diameter this bigger
+drill_bottom = 1.2; // solid bottom (where the holes end)
+drill_cone = 1.5; // top of the hole is wider by this
+angled_height = 7;
+
+item_height = 8; // height of the first row
+item_depth = sizes_max + 2*drill_cone + angled_height/sqrt(2);
+item_h_step = angled_height/sqrt(2); // other rows increment
+
+epsilon = 0.01;
+infty = 100;
+
+// holder for a single bit
+module one_slot(diam, width, depth, height) {
+ // precision holes; see
+ // http://hydraraptor.blogspot.cz/2011/02/polyholes.html
+ // for details
+ n = max(round(2 * (diam + diam_tolerance)),3);
+ assign(diam1 = (diam + diam_tolerance) / cos(180/n))
+ difference() {
+ // object body
+ translate([0, 0, 0])
+ cube([width, depth, height]);
+ // drill hole
+ translate([width/2, (depth+angled_height/sqrt(2))/2, drill_bottom])
+ cylinder(r = diam1/2, h = infty, $fn=n);
+ // top cone
+ translate([width/2, (depth+angled_height/sqrt(2))/2, height-drill_cone])
+ cylinder(r1 = diam1/2, r2 = (diam+drill_cone)/2,
+ h = drill_cone+epsilon,
+ $fn = n);
+ // angled front side
+ translate([0, 0, height-angled_height/sqrt(2)])
+ rotate([-45, 0, 0])
+ translate([-infty/2, -infty, -infty/2])
+ cube(infty);
+ // text
+ translate([width/2, 0, height-angled_height/sqrt(2)])
+ rotate([45, 0, 0])
+ scale([0.1, 0.1, 0.2])
+ translate([0, 12, 5-(0.8/0.1)])
+ DroidSans(str(diam));
+ };
+};
+
+module one_row(row, height) {
+ assign(item_width = total_width/len(row),
+ depth = row[len(row)-1] + 2*drill_cone + angled_height/sqrt(2))
+ for (i = [0 : len(row)-1])
+ translate([i*(item_width-epsilon), 0, 0])
+ one_slot(row[len(row)-1-i], item_width, depth, height);
+};
+
+module all_rows(rows) {
+ for (i = [0 : len(rows)-1]) {
+ translate([0, row_y_offsets[i] + i*(2*drill_cone + angled_height/sqrt(2) - epsilon), 0])
+ one_row(rows[i],
+ item_height+item_h_step*i);
+ };
+};
+
+translate([-total_width/2, -len(sizes)*item_depth/2, 0])
+ all_rows(sizes);