chiark / gitweb /
sewing-table: Interlock: transpose extrude and iteration (nfc)
[reprap-play.git] / sewing-table.scad.m4
index dd3f0f1c25afbe190e30e1220049400435f92c4e..04e45985d0a003bdcb8e193144f529c3f43e030a 100644 (file)
@@ -139,22 +139,25 @@ module InterlockLobePlan(r, ymir) {
   }
 }
 
-module InterlockLobeCore(negative=0) {
+module InterlockEdge(left_cnr, right_cnr, negative=0, nlobes=2) {
   r = negative ? interlock_negative_rad : interlock_rad;
   plusth = negative * 1.0;
   ymir = negative ? 0 : 1;
+
+  INREFFRAME(left_cnr, right_cnr) {
   translate([0, 0, plusth]){
     mirror([0,0,1]){
       linear_extrude(height=tile_th+plusth*2, convexity=10){
+    for (lobei = [ 0 : nlobes-1 ]) {
+      lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
+      translate([lobex, 0, 0]) {
        InterlockLobePlan(r, ymir);
       }
     }
   }
-}
-
-module InterlockLobe(this_cnr, right_cnr, negative=0) {
-  INREFFRAME(this_cnr, right_cnr)
-    InterlockLobeCore(negative);
+      }
+    }
+  }
 }
 
 function TestPiece_holes2corners(holes) =
@@ -170,7 +173,7 @@ module TestPiece1(){ ////toplevel
   corners = TestPiece_holes2corners(holes);
   difference(){
     TileBase(corners[0], corners[2]);
-    InterlockLobe(corners[1], corners[2], 1);
+    InterlockEdge(corners[1], corners[2], 1, nlobes=1);
   }
   Posts(holes);
   RoundEdge(corners[0], corners[1]);
@@ -186,7 +189,7 @@ module TestPiece2(){ ////toplevel
   TileBase(corners[0], corners[2]);
   Posts(holes);
   RoundEdge(corners[0], corners[1]);
-  InterlockLobe(corners[3], corners[0]);
+  InterlockEdge(corners[3], corners[0], 0, nlobes=1);
 }
 
 module TestDemo(){ ////toplevel
@@ -221,6 +224,7 @@ module Tile02(){ ////toplevel
   RoundEdge(c[0], c[1]);
   RoundEdge(c[3], c[0]);
   RoundLeftCorner(c[0], c[1]);
+  InterlockEdge(c[2], c[3], 0, 2);
 }
 
 module Tile12(){ ////toplevel