make sure corner rounding radius is big enough
[ozzloy@gmail.com/3d-printables] / place-value-manipulative.scad
index 2ac9ecb268e92879b79c5f9f69b534a9a72b1c58..8e5b21e3dbbdf75c6cb72a53fcc8adab24837a6c 100644 (file)
@@ -4,16 +4,23 @@
   please do not remove this notice.
 */
 
-//$fn = 30; // use this while editing
-$fn = 100; // use this for generating STL
+ones_place();
+//tens_place();
+//hundreds_place();
+//thousands_place();
+
+// use this while editing so previewing is faster:
+//$fn = 30;
+// use this for generating STL so model is more accurate:
+$fn = 100;
 
-// how big each ones place side is
-side_length = 20;
+// how big each ones place side is in millimeters
+side_length = 10;
 
 // modify this to your aesthetic taste
 corner_radius = side_length / 6;
 
-connector_thickness = corner_radius;
+connector_thickness = side_length / 4;
 
 fudge = 0.1;
 
@@ -26,7 +33,7 @@ module round_inside_corners(r) {
 module round_outside_corners(r) {
   fillet(-r) children(); }
 
-module connector_base(connector_thickness) {
+module connector_tab(connector_thickness) {
   rotate([0, -90, -90]) {
     translate([corner_radius / 2, 0, 0]) {
       linear_extrude(height = connector_thickness) {
@@ -42,47 +49,34 @@ module ones_place() {
     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, -fudge, -fudge]) {
+      connector_tab(connector_thickness); }
     translate([side_length / 2,
                side_length - connector_thickness + fudge,
                -fudge]) {
-      connector_base(connector_thickness); } }
+      connector_tab(connector_thickness); } }
   translate([side_length / 2,
              0,
-             side_length - 3 * fudge]) {
-    connector_base(connector_thickness - 3 * fudge); }
+             side_length - 2 * fudge]) {
+    connector_tab(connector_thickness - 2 * fudge); }
   translate([side_length / 2,
-             side_length - connector_thickness + 3 * fudge,
-             side_length - 3 * fudge]) {
-    connector_base(connector_thickness - 3 * fudge); } }
+             side_length - connector_thickness + 2 * fudge,
+             side_length - 2 * fudge]) {
+    connector_tab(connector_thickness - 2 * fudge); } }
 
 module tens_place() {
   for(ones_index = [0 : (10 - 1)]) {
-    translate([ones_index * side_length, 0]) {
+    translate([ones_index * side_length, 0, 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(); } } } }
+    translate([0, tens_index * side_length, 0]) {
+      tens_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(); } } } } }
-
+        translate([0, 0, hundreds_index * side_length]) {
+          hundreds_place(); } } }
 
-
-//connector_base(connector_thickness);
-
-ones_place();
-//tens_place();
-//hundreds_place();
-//thousands_place();
+//connector_tab(connector_thickness);