chiark / gitweb /
knifeblock: move minx, maxx (nfc)
[reprap-play.git] / knifeblock.scad
1 // -*- C -*-
2
3 // properties of the knives
4 nknives = 3;
5 widths = [15.5, 15.8, 19.0];
6 handlelenbase = 75;
7 handlelendelta = [-15, 0, 10];
8 locations = [-35, 0, 40];
9 bladew = 5; // 2.5
10 maxhandledepth = 45;
11
12 templatescale = 27.2 / 19.6;
13
14 // other tuneables
15 front = 5;
16 back = 5;
17 height = 50;
18 minsidein = 4;
19 minsideout = 4;
20
21 frontbackslop = 0.25;
22
23 screwbackdepth = 6.0 - 1.0;
24 screwdia =       4.0 + 0.5;
25 screwcsinkdia =  9.8 + 1.0;
26
27 screwabove = 15;
28
29 // computed
30 side = minsidein + screwcsinkdia + minsideout;
31 totaldepth = front + maxhandledepth + back;
32
33 minkx = locations[0] -         widths[0]        /2;
34 maxkx = locations[nknives-1] + widths[nknives-1]/2;
35
36 minx = minkx - side;
37 maxx = maxkx + side;
38
39 module ImportTemplate(w,k,t) {
40   fn = str("knifeblock-knives-t",k,t,".dxf");
41   echo(fn);
42   translate([0,0, -w/2])
43     linear_extrude(height=w)
44     scale(templatescale) import(file=fn, convexity=100);
45 }
46
47 module Knife(k){
48   ImportTemplate(bladew, k,"bl");
49   hull(){
50     ImportTemplate(widths[k], k,"hl");
51     translate([-100,0,0])
52       ImportTemplate(widths[k], k,"hl");
53   }
54 }
55
56 module DoKnife(k){
57   translate([locations[k],0,0]){
58     rotate([0,90,0])
59       translate([-(handlelenbase + handlelendelta[k]),0,0])
60       Knife(k);
61   }
62 }
63
64 module DoKnives(){
65   for (k=[0:nknives-1])
66     DoKnife(k);
67 }
68
69 module ScrewHole(){
70   translate([0,-50,0])
71     rotate([-90,0,0])
72     cylinder(r=screwdia/2, h=150, $fn=40);
73   translate([0, totaldepth-front - screwbackdepth, 0])
74     rotate([90,0,0])
75     cylinder(r=screwcsinkdia/2 / (sqrt(3)/2), h=100, $fn=6);
76 }
77
78 module Block(){
79   sidemidx = minsideout + screwcsinkdia/2;
80
81   difference(){
82     hull() mirror([0,0,1]) {
83       translate([minx, 0, 0])
84         cube([maxx-minx, totaldepth-front, height]);
85       for (x=[minx + front/2, maxx - front/2])
86         translate([x, -front/2, 0])
87         cylinder(r=front/2, h=height, $fn=30);
88     }
89     for (x=[minx + sidemidx, maxx - sidemidx]) {
90       translate([x, 0, -screwabove])
91         ScrewHole();
92     }
93     for (yshift=[-1,1])
94       translate([0, yshift * frontbackslop, 0])
95         DoKnives();
96   }
97 }
98
99 module BlockPrint(){ ////toplevel
100   rotate([0,0,90])
101     Block();
102 }
103
104 module Demo(){ ////toplevel
105   Block();
106   %DoKnives();
107 }
108
109 Demo();