chiark / gitweb /
screw-recess-test: break out RecessedScrewCutout_recessdepth (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 11 Feb 2015 21:31:24 +0000 (21:31 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 11 Feb 2015 21:37:10 +0000 (21:37 +0000)
screw-recess-test.scad

index 9da37e4..c4c2618 100644 (file)
@@ -15,13 +15,15 @@ module RecessScrewCutout_RecessCylinder(recessdia,zbelow, h){
 RecessedScrewCutout_defaultrecessdepth_flat = -0.35;
 RecessedScrewCutout_defaultrecessdepth_hex = -0.70;
 
+function RecessedScrewCutout_recessdepth(recessdia, recessdepth_arg) =
+  recessdepth_arg >= 0 ? recessdepth_arg : -recessdepth_arg * recessdia;
+
 module RecessedScrewCutout(shaftdia, recessdia, shaftlen,
         zbelow=1,
         recessdepth_arg=RecessedScrewCutout_defaultrecessdepth_flat) {
   // pass recessdepth_arg=-1 for the default for flat heads
   // pass recessdepth_arg=-1 for the default for flat heads
-  recessdepth = recessdepth_arg >= 0 ? recessdepth_arg
-    : -recessdepth_arg * recessdia;
+  recessdepth = RecessedScrewCutout_recessdepth(recessdia, recessdepth_arg);
   recesstopz = recessdepth + 0.5*recessdia + 0.1;
   xblocky = shaftdia + 0.1;