chiark / gitweb /
knifeblock: toplevels
[reprap-play.git] / knifeblock.scad
index 6dc35dd425f3e4febdd0084b149f1e13e2c8b1fe..302dacb73739d6cc1ee2ff1099c1a400163843d2 100644 (file)
 // -*- C -*-
-//import(file="t.dxf");
 
-module ImportTemplate(k,t) {
+// properties of the knives
+nknives = 3;
+widths = [15.5, 15.8, 19.0];
+handlelenbase = 75;
+handlelendelta = [-15, 0, 10];
+locations = [-35, 0, 40];
+bladew = 5; // 2.5
+maxhandledepth = 45;
+
+templatescale = 27.2 / 19.6;
+
+// other tuneables
+front = 5;
+back = 5;
+height = 50;
+minsidein = 4;
+minsideout = 4;
+
+frontbackslop = 0.25;
+
+screwbackdepth = 6.0 - 1.0;
+screwdia =       4.0 + 0.5;
+screwcsinkdia =  9.8 + 1.0;
+
+screwabove = 15;
+
+// computed
+side = minsidein + screwcsinkdia + minsideout;
+totaldepth = front + maxhandledepth + back;
+
+module ImportTemplate(w,k,t) {
   fn = str("knifeblock-knives-t",k,t,".dxf");
   echo(fn);
-  import(file=fn, convexity=100);
+  translate([0,0, -w/2])
+    linear_extrude(height=w)
+    scale(templatescale) import(file=fn, convexity=100);
 }
 
 module Knife(k){
-  translate([0,50*k,0]){
-    ImportTemplate(k,"bl");
-    translate([0,0,10])
-      ImportTemplate(k,"hl");
+  ImportTemplate(bladew, k,"bl");
+  hull(){
+    ImportTemplate(widths[k], k,"hl");
+    translate([-100,0,0])
+      ImportTemplate(widths[k], k,"hl");
+  }
+}
+
+module DoKnife(k){
+  translate([locations[k],0,0]){
+    rotate([0,90,0])
+      translate([-(handlelenbase + handlelendelta[k]),0,0])
+      Knife(k);
+  }
+}
+
+module DoKnives(){
+  for (k=[0:nknives-1])
+    DoKnife(k);
+}
+
+module ScrewHole(){
+  translate([0,-50,0])
+    rotate([-90,0,0])
+    cylinder(r=screwdia/2, h=150, $fn=40);
+  translate([0, totaldepth-front - screwbackdepth, 0])
+    rotate([90,0,0])
+    cylinder(r=screwcsinkdia/2 / (sqrt(3)/2), h=100, $fn=6);
+}
+
+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(){
+    hull() mirror([0,0,1]) {
+      translate([minx, 0, 0])
+       cube([maxx-minx, totaldepth-front, height]);
+      for (x=[minx + front/2, maxx - front/2])
+       translate([x, -front/2, 0])
+       cylinder(r=front/2, h=height, $fn=30);
+    }
+    for (x=[minx + sidemidx, maxx - sidemidx]) {
+      translate([x, 0, -screwabove])
+       ScrewHole();
+    }
+    for (yshift=[-1,1])
+      translate([0, yshift * frontbackslop, 0])
+       DoKnives();
   }
 }
 
-Knife(0);
-Knife(1);
-Knife(2);
-//import(file="knifeblock-knives-t0bl.dxf",convexity=100);
+module BlockPrint(){ ////toplevel
+  rotate([0,0,90])
+    Block();
+}
+
+module Demo(){ ////toplevel
+  Block();
+  %DoKnives();
+}
+
+Demo();