chiark / gitweb /
knifeblock: Holes refactor: rename i to j in Holes (nfc)
[reprap-play.git] / knifeblock.scad
index 7ea6079d580a4221ad95a69e589f6909b885a4ac..9a7303a41b0a72503bb02c4e5f88d3c333f8aba7 100644 (file)
@@ -133,7 +133,7 @@ module AtSides(){
 }
 
 module BlockPegSlot(){
-  translate([recessblockwidth/2, pegrecess - 0.5*peglen, -height]){
+  translate([recessblockwidth/2, pegrecess - peglen, -height]){
     rotate([-90,0,0]) linear_extrude(height=totaldepth){
       PegTemplate(peghead/2 * 1.2);
     }
@@ -168,9 +168,9 @@ module CoverTemplate(){
   linear_extrude(height=coverthick)
     polygon([[minx, 0],
             [maxx, 0],
-            [maxx, coverlonglen],
-            [maxx - coverside, coverlonglen],
-            [minx, covershortlen]]);
+            [maxx, coverlonglen+0.1],
+            [maxx - coverside, coverlonglen+0.1],
+            [minx, covershortlen+0.1]]);
 }
 
 module CoverSide(len){
@@ -219,7 +219,7 @@ module HoleRow(){
   echo("Holes Y count ", imax);
   for (i=[0:imax]) {
     translate([0, (i+0.5)*holepitch, -20])
-      cylinder(r=holesize/2, h=40, $fn=20);
+      cylinder(r=holesize/2, h=40, $fn=40);
   }
 }
 
@@ -234,12 +234,12 @@ module HolesScope(){
 }
 
 module Holes(){
-  imin = ceil((maxx-minx)/(sqrt(3)*holepitch));
-  echo("Holes X count 2 x", imin);
+  jmin = ceil((maxx-minx)/(sqrt(3)*holepitch));
+  echo("Holes X count 2 x", jmin);
   intersection(){
     translate([holeoffx * holepitch, holeoffy * holepitch, 0]) {
-      for (i=[-imin:2]) {
-       translate([i * sqrt(3) * holepitch, 0, 0]) {
+      for (j=[-jmin:2]) {
+       translate([j * sqrt(3) * holepitch, 0, 0]) {
          HoleRow();
          translate([sqrt(3)/2 * holepitch, -0.5 * holepitch, 0])
            HoleRow();
@@ -285,12 +285,15 @@ module Demo(){ ////toplevel
   color([1,0,0]) AtSides() { DemoPeg(); DemoPeg(); }
 }
 
+module Pegs(){ ////toplevel
+  Peg();
+  translate([-peghead-3, 0,0]) Peg();
+}
+
 module CoverParts(){ ////toplevel
   Cover();
-  translate([0, coverlonglen, pegheight/2]) {
-    Peg();
-    translate([-peghead-3, 0,0]) Peg();
-  }
+  translate([0, coverlonglen, pegheight/2-pegslopv])
+    Pegs();
 }
 
 //Block();
@@ -299,3 +302,6 @@ module CoverParts(){ ////toplevel
 //CoverParts();
 //Peg();
 //Cover();
+//Holes();
+//%CoverTemplate();
+//Pegs();