chiark / gitweb /
knifeblock: Fewer holes
[reprap-play.git] / knifeblock.scad
index 4ca20e79a2012ccfc4c9a04a8a2a641780bf6c3f..7ea6079d580a4221ad95a69e589f6909b885a4ac 100644 (file)
@@ -215,7 +215,9 @@ module CoverPegSlot(coverlen){
 }
 
 module HoleRow(){
-  for (i=[0:10]) {
+  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=20);
   }
@@ -232,9 +234,11 @@ module HolesScope(){
 }
 
 module Holes(){
+  imin = ceil((maxx-minx)/(sqrt(3)*holepitch));
+  echo("Holes X count 2 x", imin);
   intersection(){
     translate([holeoffx * holepitch, holeoffy * holepitch, 0]) {
-      for (i=[-10:10]) {
+      for (i=[-imin:2]) {
        translate([i * sqrt(3) * holepitch, 0, 0]) {
          HoleRow();
          translate([sqrt(3)/2 * holepitch, -0.5 * holepitch, 0])