enlarge blocks
[ozzloy@gmail.com/3d-printables] / place-value-manipulative.scad
CommitLineData
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
15448998 7/*****************************************************/
8/* binary */
9//ones_place();
10//twos_place();
11//fours_place();
12//eights_place();
13
14/*****************************************************/
15/* trinary */
16//ones_place();
17//threes_place();
18//nines_place();
19twenty_sevens_place();
20
21/*****************************************************/
22/* decimal */
23//ones_place();
636e9b88 24//tens_place();
25//hundreds_place();
26//thousands_place();
27
28// use this while editing so previewing is faster:
29//$fn = 30;
30// use this for generating STL so model is more accurate:
31$fn = 100;
295108ca 32
636e9b88 33// how big each ones place side is in millimeters
088d46a7 34side_length = 20;
295108ca 35
36// modify this to your aesthetic taste
37corner_radius = side_length / 6;
38
636e9b88 39connector_thickness = side_length / 4;
295108ca 40
41fudge = 0.1;
42
43module fillet(r) {
44 offset(-r) { offset(r) { children(); } } }
45
46module round_inside_corners(r) {
47 fillet(r) children(); }
48
49module round_outside_corners(r) {
50 fillet(-r) children(); }
51
f930512a 52module connector_tab(connector_thickness) {
295108ca 53 rotate([0, -90, -90]) {
54 translate([corner_radius / 2, 0, 0]) {
55 linear_extrude(height = connector_thickness) {
56 intersection() {
57 circle(corner_radius, $fn = 3);
58 translate([-corner_radius, -corner_radius]) {
59 square([corner_radius, 2 * corner_radius]); } }
60 round_outside_corners(corner_radius / 3) {
61 circle(corner_radius, $fn = 3); } } } } }
62
63module ones_place() {
64 difference() {
65 linear_extrude(height = side_length) {
66 round_outside_corners(corner_radius) {
67 square(side_length); } }
1a5b288b 68 translate([side_length / 2, -fudge, -fudge]) {
f930512a 69 connector_tab(connector_thickness); }
295108ca 70 translate([side_length / 2,
71 side_length - connector_thickness + fudge,
72 -fudge]) {
f930512a 73 connector_tab(connector_thickness); } }
295108ca 74 translate([side_length / 2,
75 0,
1a5b288b 76 side_length - 2 * fudge]) {
f930512a 77 connector_tab(connector_thickness - 2 * fudge); }
295108ca 78 translate([side_length / 2,
1a5b288b 79 side_length - connector_thickness + 2 * fudge,
80 side_length - 2 * fudge]) {
f930512a 81 connector_tab(connector_thickness - 2 * fudge); } }
295108ca 82
15448998 83/*****************************************************/
84/* decimal */
295108ca 85module tens_place() {
86 for(ones_index = [0 : (10 - 1)]) {
1adc9566 87 translate([ones_index * side_length, 0, 0]) {
295108ca 88 ones_place(); } } }
89
90module hundreds_place() {
91 for(tens_index = [0 : (10 - 1)]) {
1adc9566 92 translate([0, tens_index * side_length, 0]) {
93 tens_place(); } } }
295108ca 94
95module thousands_place() {
96 for(hundreds_index = [0 : (10 - 1)]) {
1adc9566 97 translate([0, 0, hundreds_index * side_length]) {
98 hundreds_place(); } } }
295108ca 99
15448998 100
101/*****************************************************/
102/* binary */
103module twos_place() {
104 for(ones_index = [0 : (2 - 1)]) {
105 translate([ones_index * side_length, 0, 0]) {
106 ones_place(); } } }
107
108module fours_place() {
109 for(twos_index = [0 : (2 - 1)]) {
110 translate([0, twos_index * side_length, 0]) {
111 twos_place(); } } }
112
113module eights_place() {
114 for(fours_index = [0 : (2 - 1)]) {
115 translate([0, 0, fours_index * side_length]) {
116 fours_place(); } } }
117
118/*****************************************************/
119/* trinary */
120module threes_place() {
121 for(ones_index = [0 : (3 - 1)]) {
122 translate([ones_index * side_length, 0, 0]) {
123 ones_place(); } } }
124
125module nines_place() {
126 for(threes_index = [0 : (3 - 1)]) {
127 translate([0, threes_index * side_length, 0]) {
128 threes_place(); } } }
129
130module twenty_sevens_place() {
131 for(nines_index = [0 : (3 - 1)]) {
132 translate([0, 0, nines_index * side_length]) {
133 nines_place(); } } }
134
f930512a 135//connector_tab(connector_thickness);