From fa37c30f896f17b5c6be1386b718383d57553c3a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 1 Jan 2015 14:37:47 +0000 Subject: [PATCH] knifeblock: introduce width() (nfc) --- knifeblock.scad | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/knifeblock.scad b/knifeblock.scad index 1133e1c..528bb32 100644 --- a/knifeblock.scad +++ b/knifeblock.scad @@ -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"); } } -- 2.30.2