chiark / gitweb /
knifeblock: Holes refactor: fold in HoleRow (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 1 Jan 2015 23:46:25 +0000 (23:46 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 1 Jan 2015 23:46:25 +0000 (23:46 +0000)
knifeblock.scad

index 9a7303a41b0a72503bb02c4e5f88d3c333f8aba7..b1a4052f15383261b5bc6437b598dde32a8d03b1 100644 (file)
@@ -214,15 +214,6 @@ module CoverPegSlot(coverlen){
   }
 }
 
-module HoleRow(){
-  imax = ceil(coverlonglen / holepitch);
-  echo("Holes Y count ", imax);
-  for (i=[0:imax]) {
-    translate([0, (i+0.5)*holepitch, -20])
-      cylinder(r=holesize/2, h=40, $fn=40);
-  }
-}
-
 module HolesScope(){
   intersection_for (dx=[-1,+1]) {
     intersection_for (dy=[-1,+1]) {
@@ -233,17 +224,26 @@ module HolesScope(){
   }
 }
 
+module Hole(){
+  cylinder(r=holesize/2, h=40, $fn=40);
+}
+
 module Holes(){
+  imax = ceil(coverlonglen / holepitch);
+  echo("Holes Y count ", imax);
   jmin = ceil((maxx-minx)/(sqrt(3)*holepitch));
   echo("Holes X count 2 x", jmin);
   intersection(){
     translate([holeoffx * holepitch, holeoffy * holepitch, 0]) {
-      for (j=[-jmin:2]) {
-       translate([j * sqrt(3) * holepitch, 0, 0]) {
-         HoleRow();
-         translate([sqrt(3)/2 * holepitch, -0.5 * holepitch, 0])
-           HoleRow();
-       }
+      for (i=[0:imax]) {
+       translate([0, (i+0.5)*holepitch, -20])
+         for (j=[-jmin:2]) {
+           translate([j * sqrt(3) * holepitch, 0, 0]) {
+             Hole();
+             translate([sqrt(3)/2 * holepitch, -0.5 * holepitch, 0])
+               Hole();
+           }
+         }
       }
     }
     HolesScope();