chiark / gitweb /
sewing-table: Interlock: introduce InterlockEdgePlan (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 2 Jan 2017 14:55:00 +0000 (14:55 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 2 Jan 2017 14:55:00 +0000 (14:55 +0000)
sewing-table.scad.m4

index 04e45985d0a003bdcb8e193144f529c3f43e030a..6c4467651985fd663cfb853253c4548bc0f9411a 100644 (file)
@@ -121,7 +121,10 @@ module RoundLeftCorner(this_cnr, right_cnr) {
   }
 }
 
-module InterlockLobePlan(r, ymir) {
+module InterlockLobePlan(negative) {
+  r = negative ? interlock_negative_rad : interlock_rad;
+  ymir = negative ? 0 : 1;
+
   dx = sqrt(3) * r;
   $fn= 80;
   translate([thehd[0], 0]){
@@ -139,22 +142,24 @@ module InterlockLobePlan(r, ymir) {
   }
 }
 
+module InterlockEdgePlan(negative, nlobes, length) {
+  for (lobei = [ 0 : nlobes-1 ]) {
+    lobex = (length - thehd[0]*2) * (lobei ? lobei / (nlobes-1) : 0);
+    translate([lobex, 0, 0]) {
+      InterlockLobePlan(negative);
+    }
+  }
+}
+
 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);
-      }
-    }
-  }
+    translate([0, 0, plusth]){
+      mirror([0,0,1]){
+       linear_extrude(height=tile_th+plusth*2, convexity=10){
+         InterlockEdgePlan(negative, nlobes, length);
+       }
       }
     }
   }