chiark / gitweb /
knifeblock: cover, add { } (nfc)
[reprap-play.git] / knifeblock.scad
index 12450f169472307687367c6add0427c4d304778f..273d77c883502f0146e2c440b9495e718777bae4 100644 (file)
@@ -11,6 +11,9 @@ maxhandledepth = 45;
 
 templatescale = 27.2 / 19.6;
 
+coverlonglen = 120; // xxx
+covershortlen = 70; // xxx
+
 // other tuneables
 front = 5;
 back = 5;
@@ -26,10 +29,23 @@ screwcsinkdia =  9.8 + 1.0;
 
 screwabove = 15;
 
+coverthick = 2.4;
+coverside = coverthick;
+
+covertopwing = 15;
+covertopwingbase = 20;
+coveredge = 3;
+
 // computed
 side = minsidein + screwcsinkdia + minsideout;
 totaldepth = front + maxhandledepth + back;
 
+minkx = locations[0] -         widths[0]        /2;
+maxkx = locations[nknives-1] + widths[nknives-1]/2;
+
+minx = minkx - side;
+maxx = maxkx + side;
+
 module ImportTemplate(w,k,t) {
   fn = str("knifeblock-knives-t",k,t,".dxf");
   echo(fn);
@@ -70,12 +86,6 @@ module ScrewHole(){
 }
 
 module Block(){
-  minkx = locations[0] -         widths[0]        /2;
-  maxkx = locations[nknives-1] + widths[nknives-1]/2;
-
-  minx = minkx - side;
-  maxx = maxkx + side;
-
   sidemidx = minsideout + screwcsinkdia/2;
 
   difference(){
@@ -96,5 +106,52 @@ module Block(){
   }
 }
 
-rotate([0,0,90])
-  Block();
+module BlockPrint(){ ////toplevel
+  rotate([0,0,90])
+    Block();
+}
+
+module CoverTemplate(){
+  linear_extrude(height=coverthick)
+    polygon([[minx, 0],
+            [maxx, 0],
+            [maxx, coverlonglen],
+            [maxx - coverside, coverlonglen],
+            [minx, covershortlen]]);
+}
+
+module CoverSide(xpos, len){
+  translate([xpos, 0 ,0]) {
+    rotate([90,0,90])
+      linear_extrude(height=coverside)
+      polygon([[0,                      0],
+              [0,                      totaldepth],
+              [covertopwing,           totaldepth],
+              [covertopwingbase,       coverside + coverthick],
+              [len - covertopwingbase, coverside + coverthick],
+              [len - covertopwing,     totaldepth],
+              [len,                    totaldepth],
+              [len,                    0]]);
+  }
+}
+
+module Cover(){
+  CoverTemplate();
+  CoverSide(minx,           covershortlen);
+  CoverSide(maxx-coverside, coverlonglen);
+}
+
+module CoverAligned(){
+  translate([0,-front,-height])
+    rotate([-90,0,0])
+    Cover();
+}
+
+module Demo(){ ////toplevel
+  %Block();
+  DoKnives();
+  color([0,0,1]) CoverAligned();
+}
+
+Demo();
+//Cover();