chiark / gitweb /
knifeblock: introduce width() (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 1 Jan 2015 14:37:47 +0000 (14:37 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 1 Jan 2015 14:37:47 +0000 (14:37 +0000)
knifeblock.scad

index 1133e1cffbc106b3d3275bf9c68f96ab3383c6a3..528bb32f68477a05f464f13566108fbb8f63896c 100644 (file)
@@ -59,11 +59,14 @@ pegslopl = 0.5;
 pegdepthproportion = 0.80;
 
 // computed
+
+function width(k) = widths[k];
+
 side = minsidein + screwcsinkdia + minsideout;
 totaldepth = front + maxhandledepth + back;
 
-minkx = locations[0] -         widths[0]        /2;
-maxkx = locations[nknives-1] + widths[nknives-1]/2;
+minkx = locations[0] -         width(0)        /2;
+maxkx = locations[nknives-1] + width(nknives-1)/2;
 
 minx = minkx - side;
 maxx = maxkx + side;
@@ -83,9 +86,9 @@ module ImportTemplate(w,k,t) {
 module Knife(k){
   ImportTemplate(bladew, k,"bl");
   hull(){
-    ImportTemplate(widths[k], k,"hl");
+    ImportTemplate(width(k), k,"hl");
     translate([-100,0,0])
-      ImportTemplate(widths[k], k,"hl");
+      ImportTemplate(width(k), k,"hl");
   }
 }