chiark / gitweb /
quacks-ingredients: sort out Tests
[reprap-play.git] / quacks-ingredients.scad
index e54aa1f884190dc414aaf82859d64ab03bc59a67..50b38e0f0368befb283d07e3ce156e9eaa34bfc2 100644 (file)
@@ -1,17 +1,17 @@
 // -*- C -*-
 
-token_dia = 18;
-spot_dia = 4;
+token_dia = 21;
+spot_dia = 4.5;
 spot_gap = spot_dia / 3.0;
 
 thick = 1.5;
 
 multicolour_gap = 0.15; // each side
 initial_layer_thick = 0.400;
-//initial_layer_width = 0.750;
+initial_layer_width = 0.750;
 final_layer_thick = 0.250;
+multicolour_post = 4;
 
-$nspots = 3;
 $spots_absent = false;
 $spots_plusgap = false;
 
@@ -35,11 +35,9 @@ module Spots_Extrude_Upper(){
 
 module SpotAt(condition, xy) {
   if (condition == !$spots_absent) {
-    echo(condition, $spots_absent, "Y");
     translate(xy * (spot_gap + spot_dia) * sqrt(0.5))
-      circle(r= spot_dia/2);
-  } else {
-    echo(condition, $spots_absent, "N");
+      circle(r= spot_dia/2 +
+            ($spots_plusgap ? multicolour_gap : 0));
   }
 }
 
@@ -88,10 +86,24 @@ module Token_L5(){
     Token_Spots();
 }
 
-module Demo(){ ////toplevel
-  color("red") { Token_L3(); }
-  color("white") { Token_L1(); Token_L5(); }
-  color("black") { Token_L2(); Token_L4(); }
+module Frame(phase, base_sz) {
+  zs = [ initial_layer_thick,
+        initial_layer_thick,
+        thick,
+        thick,
+        thick ];
+
+  sz = base_sz + phase * initial_layer_width * 2 * [1,1];
+  linear_extrude(height= initial_layer_thick) {
+    difference(){
+      square(center=true, sz + initial_layer_width * 2 * [1,1]);
+      square(center=true, sz);
+    }
+  }
+  // Priming tower
+  translate([-base_sz[0]/2, (3-phase)*(multicolour_post + multicolour_gap)])
+    linear_extrude(height= zs[phase-1])
+    square(multicolour_post);
 }
 
 module Tests(){
@@ -101,20 +113,9 @@ module Tests(){
   }
 }
 
-module Test_L1(){ ////toplevel
-  Tests() Token_L1();
-}
-module Test_L2(){ ////toplevel
-  Tests() Token_L2();
-}
-module Test_L3(){ ////toplevel
-  Tests() Token_L3();
-}
-module Test_L4(){ ////toplevel
-  Tests() Token_L4();
-}
-module Test_L5(){ ////toplevel
-  Tests() Token_L5();
+module Tests_L() { ////toplevel
+  Frame($phase, token_dia * [ 6, 1.5 ]);
+  Tests() Token_L();
 }
 
 //Demo();