add place value manipulative
authordaniel watson <ozzloy@gmail.com>
Mon, 9 Apr 2018 02:40:39 +0000 (19:40 -0700)
committerdaniel watson <ozzloy@gmail.com>
Mon, 9 Apr 2018 02:40:39 +0000 (19:40 -0700)
place-value-manipulative.scad [new file with mode: 0644]

diff --git a/place-value-manipulative.scad b/place-value-manipulative.scad
new file mode 100644 (file)
index 0000000..2ac9ecb
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+  GNU AGPLv3 (or later at your option)
+  see bottom for more license info.
+  please do not remove this notice.
+*/
+
+//$fn = 30; // use this while editing
+$fn = 100; // use this for generating STL
+
+// how big each ones place side is
+side_length = 20;
+
+// modify this to your aesthetic taste
+corner_radius = side_length / 6;
+
+connector_thickness = corner_radius;
+
+fudge = 0.1;
+
+module fillet(r) {
+   offset(-r) { offset(r) { children(); } } }
+
+module round_inside_corners(r) {
+  fillet(r) children(); }
+
+module round_outside_corners(r) {
+  fillet(-r) children(); }
+
+module connector_base(connector_thickness) {
+  rotate([0, -90, -90]) {
+    translate([corner_radius / 2, 0, 0]) {
+      linear_extrude(height = connector_thickness) {
+        intersection() {
+          circle(corner_radius, $fn = 3);
+          translate([-corner_radius, -corner_radius]) {
+            square([corner_radius, 2 * corner_radius]); } }
+        round_outside_corners(corner_radius / 3) {
+          circle(corner_radius, $fn = 3); } } } } }
+
+module ones_place() {
+  difference() {
+    linear_extrude(height = side_length) {
+      round_outside_corners(corner_radius) {
+        square(side_length); } }
+    translate([side_length / 2, -0.1, -0.1]) {
+      connector_base(connector_thickness); }
+    translate([side_length / 2,
+               side_length - connector_thickness + fudge,
+               -fudge]) {
+      connector_base(connector_thickness); } }
+  translate([side_length / 2,
+             0,
+             side_length - 3 * fudge]) {
+    connector_base(connector_thickness - 3 * fudge); }
+  translate([side_length / 2,
+             side_length - connector_thickness + 3 * fudge,
+             side_length - 3 * fudge]) {
+    connector_base(connector_thickness - 3 * fudge); } }
+
+module tens_place() {
+  for(ones_index = [0 : (10 - 1)]) {
+    translate([ones_index * side_length, 0]) {
+      ones_place(); } } }
+
+module hundreds_place() {
+  for(tens_index = [0 : (10 - 1)]) {
+    for(ones_index = [0 : (10 - 1)]) {
+      translate([ones_index * side_length,
+                 tens_index * side_length]) {
+        ones_place(); } } } }
+
+module thousands_place() {
+  for(hundreds_index = [0 : (10 - 1)]) {
+    for(tens_index = [0 : (10 - 1)]) {
+      for(ones_index = [0 : (10 - 1)]) {
+        translate([ones_index * side_length,
+                   tens_index * side_length,
+                   hundreds_index * side_length]) {
+          ones_place(); } } } } }
+
+
+
+//connector_base(connector_thickness);
+
+ones_place();
+//tens_place();
+//hundreds_place();
+//thousands_place();