295108ca |
1 | /* |
2 | GNU AGPLv3 (or later at your option) |
3 | see bottom for more license info. |
4 | please do not remove this notice. |
5 | */ |
6 | |
7 | //$fn = 30; // use this while editing |
8 | $fn = 100; // use this for generating STL |
9 | |
10 | // how big each ones place side is |
11 | side_length = 20; |
12 | |
13 | // modify this to your aesthetic taste |
14 | corner_radius = side_length / 6; |
15 | |
16 | connector_thickness = corner_radius; |
17 | |
18 | fudge = 0.1; |
19 | |
20 | module fillet(r) { |
21 | offset(-r) { offset(r) { children(); } } } |
22 | |
23 | module round_inside_corners(r) { |
24 | fillet(r) children(); } |
25 | |
26 | module round_outside_corners(r) { |
27 | fillet(-r) children(); } |
28 | |
29 | module connector_base(connector_thickness) { |
30 | rotate([0, -90, -90]) { |
31 | translate([corner_radius / 2, 0, 0]) { |
32 | linear_extrude(height = connector_thickness) { |
33 | intersection() { |
34 | circle(corner_radius, $fn = 3); |
35 | translate([-corner_radius, -corner_radius]) { |
36 | square([corner_radius, 2 * corner_radius]); } } |
37 | round_outside_corners(corner_radius / 3) { |
38 | circle(corner_radius, $fn = 3); } } } } } |
39 | |
40 | module ones_place() { |
41 | difference() { |
42 | linear_extrude(height = side_length) { |
43 | round_outside_corners(corner_radius) { |
44 | square(side_length); } } |
45 | translate([side_length / 2, -0.1, -0.1]) { |
46 | connector_base(connector_thickness); } |
47 | translate([side_length / 2, |
48 | side_length - connector_thickness + fudge, |
49 | -fudge]) { |
50 | connector_base(connector_thickness); } } |
51 | translate([side_length / 2, |
52 | 0, |
53 | side_length - 3 * fudge]) { |
54 | connector_base(connector_thickness - 3 * fudge); } |
55 | translate([side_length / 2, |
56 | side_length - connector_thickness + 3 * fudge, |
57 | side_length - 3 * fudge]) { |
58 | connector_base(connector_thickness - 3 * fudge); } } |
59 | |
60 | module tens_place() { |
61 | for(ones_index = [0 : (10 - 1)]) { |
62 | translate([ones_index * side_length, 0]) { |
63 | ones_place(); } } } |
64 | |
65 | module hundreds_place() { |
66 | for(tens_index = [0 : (10 - 1)]) { |
67 | for(ones_index = [0 : (10 - 1)]) { |
68 | translate([ones_index * side_length, |
69 | tens_index * side_length]) { |
70 | ones_place(); } } } } |
71 | |
72 | module thousands_place() { |
73 | for(hundreds_index = [0 : (10 - 1)]) { |
74 | for(tens_index = [0 : (10 - 1)]) { |
75 | for(ones_index = [0 : (10 - 1)]) { |
76 | translate([ones_index * side_length, |
77 | tens_index * side_length, |
78 | hundreds_index * side_length]) { |
79 | ones_place(); } } } } } |
80 | |
81 | |
82 | |
83 | //connector_base(connector_thickness); |
84 | |
85 | ones_place(); |
86 | //tens_place(); |
87 | //hundreds_place(); |
88 | //thousands_place(); |