chiark / gitweb /
poster-tube-lid: catch: adjust stalk height from v1
[reprap-play.git] / knifeblock.scad
index 528bb32f68477a05f464f13566108fbb8f63896c..c1f1869f4b1a07e9a777f9077b0274ccc7478a63 100644 (file)
@@ -5,7 +5,7 @@ nknives = 3;
 widths = [15.5, 15.8, 19.0];
 handlelenbase = 75;
 handlelendelta = [-15, 0, 10];
-locations = [-35, 0, 40];
+locations = [-35, 0, 37];
 bladew = 5; // 2.5
 maxhandledepth = 45;
 
@@ -23,6 +23,8 @@ minsideout = 4;
 
 frontbackslop = 0.25;
 
+knifewidthslop = 2.0;
+
 screwbackdepth = 6.0 - 1.0;
 screwdia =       4.0 + 0.5;
 screwcsinkdia =  9.8 + 1.0;
@@ -40,8 +42,12 @@ holesize = 12.5;
 holestrut = 7;
 holeedge = 4;
 
-holeoffx = 0.45;
-holeoffy = 0.25;
+holeoffx = 0.33;
+holeoffy = 0.23;
+
+indentdepth = 1;
+indentoutersize = holesize + 2.15;
+indentinnersize = indentoutersize - indentdepth * 3.0;
 
 pegstem = 3.5;
 peghead = 10;
@@ -60,7 +66,7 @@ pegdepthproportion = 0.80;
 
 // computed
 
-function width(k) = widths[k];
+function width(k) = widths[k] + knifewidthslop;
 
 side = minsidein + screwcsinkdia + minsideout;
 totaldepth = front + maxhandledepth + back;
@@ -131,13 +137,25 @@ 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);
     }
   }
 }
 
+module DecorativeIndents(){
+  translate([0, -front, 0])
+  rotate([90,0,0])
+  HexGrid(-height, 0, minx,maxx) {
+    hull(){
+      translate([0, 0, -indentdepth])
+       cylinder(r=indentinnersize/2, h=indentdepth, $fn=40);
+      cylinder(r=indentoutersize/2, h=indentdepth, $fn=40);
+    }
+  }
+}
+
 module Block(){
   sidemidx = minsideout + screwcsinkdia/2;
 
@@ -154,6 +172,7 @@ module Block(){
       translate([0, yshift * frontbackslop, 0])
        DoKnives();
     AtSides() { BlockPegSlot(); BlockPegSlot(); }
+    DecorativeIndents();
   }
 }
 
@@ -166,9 +185,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){
@@ -212,34 +231,44 @@ module CoverPegSlot(coverlen){
   }
 }
 
-module HoleRow(){
-  for (i=[0:10]) {
-    translate([0, (i+0.5)*holepitch, -1])
-      cylinder(r=holesize/2, h=coverthick+2, $fn=20);
-  }
-}
-
 module HolesScope(){
   intersection_for (dx=[-1,+1]) {
     intersection_for (dy=[-1,+1]) {
-      translate([dx * holeedge, dy * holeedge, -1])
-       scale([1,1,2])
+      translate([dx * holeedge, dy * holeedge, -5])
+       scale([1,1,10])
        CoverTemplate();
     }
   }
 }
 
-module Holes(){
-  intersection(){
-    translate([holeoffx * holepitch, holeoffy * holepitch, 0]) {
-      for (i=[-10:10]) {
-       translate([i * sqrt(3) * holepitch, 0, 0]) {
-         HoleRow();
-         translate([sqrt(3)/2 * holepitch, -0.5 * holepitch, 0])
-           HoleRow();
-       }
+module HexGrid(xa,xb,ya,yb) {
+  imin = floor(xa / holepitch);
+  imax =  ceil(xb / holepitch);
+  jmin = floor(ya / (sqrt(3)*holepitch));
+  jmax =  ceil(yb / (sqrt(3)*holepitch));
+  echo("HexGrid ",imin,imax,jmin,jmax);
+  for (i=[imin:imax]) {
+    for (j=[jmin:jmax]) {
+      translate([(j * sqrt(3) + holeoffx) * holepitch,
+                (i +     0.5 + holeoffy) * holepitch,
+                0]) {
+       child();
+       translate([sqrt(3)/2 * holepitch, -0.5 * holepitch, 0])
+         child();
       }
     }
+  }
+}
+
+module Hole(){
+  cylinder(r=holesize/2, h=40, $fn=40);
+}
+
+module Holes(){
+  intersection(){
+    translate([0, 0, -20])
+      HexGrid(0, coverlonglen, minx, maxx)
+      Hole();
     HolesScope();
   }
 }
@@ -279,11 +308,30 @@ 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();
+}
+
+module FrontDemo(){ ////toplevel
+  color([1,0,1]) Block();
+  color([1,0,1]) CoverAligned();
+  color([0,0,0]) DoKnives();
+}
+
+module BlockFrontTest(){ ////toplevel
+  intersection(){
+    Block();
+    translate([minx-10, -front-10, -height-10]) {
+      cube([75,14,35]);
+      cube([75,25,13]);
+    }
   }
 }
 
@@ -293,3 +341,6 @@ module CoverParts(){ ////toplevel
 //CoverParts();
 //Peg();
 //Cover();
+//Holes();
+//%CoverTemplate();
+//Pegs();