chiark / gitweb /
b0dbd6857fbf69921a6a1154b66db13627515325
[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 coverlonglen = 130; // xxx
15 covershortlen = 80; // xxx
16
17 // other tuneables
18 front = 5;
19 back = 5;
20 height = 50;
21 minsidein = 4;
22 minsideout = 4;
23
24 frontbackslop = 0.25;
25
26 screwbackdepth = 6.0 - 1.0;
27 screwdia =       4.0 + 0.5;
28 screwcsinkdia =  9.8 + 1.0;
29
30 screwabove = 15;
31
32 coverthick = 2.4;
33 coverside = coverthick;
34
35 covertopwing = 15;
36 covertopwingbase = 20;
37 coveredge = 3;
38
39 // computed
40 side = minsidein + screwcsinkdia + minsideout;
41 totaldepth = front + maxhandledepth + back;
42
43 minkx = locations[0] -         widths[0]        /2;
44 maxkx = locations[nknives-1] + widths[nknives-1]/2;
45
46 minx = minkx - side;
47 maxx = maxkx + side;
48
49 module ImportTemplate(w,k,t) {
50   fn = str("knifeblock-knives-t",k,t,".dxf");
51   echo(fn);
52   translate([0,0, -w/2])
53     linear_extrude(height=w)
54     scale(templatescale) import(file=fn, convexity=100);
55 }
56
57 module Knife(k){
58   ImportTemplate(bladew, k,"bl");
59   hull(){
60     ImportTemplate(widths[k], k,"hl");
61     translate([-100,0,0])
62       ImportTemplate(widths[k], k,"hl");
63   }
64 }
65
66 module DoKnife(k){
67   translate([locations[k],0,0]){
68     rotate([0,90,0])
69       translate([-(handlelenbase + handlelendelta[k]),0,0])
70       Knife(k);
71   }
72 }
73
74 module DoKnives(){
75   for (k=[0:nknives-1])
76     DoKnife(k);
77 }
78
79 module ScrewHole(){
80   translate([0,-50,0])
81     rotate([-90,0,0])
82     cylinder(r=screwdia/2, h=150, $fn=40);
83   translate([0, totaldepth-front - screwbackdepth, 0])
84     rotate([90,0,0])
85     cylinder(r=screwcsinkdia/2 / (sqrt(3)/2), h=100, $fn=6);
86 }
87
88 module Block(){
89   sidemidx = minsideout + screwcsinkdia/2;
90
91   difference(){
92     hull() mirror([0,0,1]) {
93       translate([minx, 0, 0])
94         cube([maxx-minx, totaldepth-front, height]);
95       for (x=[minx + front/2, maxx - front/2])
96         translate([x, -front/2, 0])
97         cylinder(r=front/2, h=height, $fn=30);
98     }
99     for (x=[minx + sidemidx, maxx - sidemidx]) {
100       translate([x, 0, -screwabove])
101         ScrewHole();
102     }
103     for (yshift=[-1,1])
104       translate([0, yshift * frontbackslop, 0])
105         DoKnives();
106   }
107 }
108
109 module BlockPrint(){ ////toplevel
110   rotate([0,0,90])
111     Block();
112 }
113
114 module CoverTemplate(){
115   linear_extrude(height=coverthick)
116     polygon([[minx, 0],
117              [maxx, 0],
118              [maxx, coverlonglen],
119              [maxx - coverside, coverlonglen],
120              [minx, covershortlen]]);
121 }
122
123 module CoverSide(xpos, len){
124   translate([xpos, 0 ,0])
125   rotate([90,0,90])
126     linear_extrude(height=coverside)
127       polygon([[0,                      0],
128                [0,                      totaldepth],
129                [covertopwing,           totaldepth],
130                [covertopwingbase,       coverside + coverthick],
131                [len - covertopwingbase, coverside + coverthick],
132                [len - covertopwing,     totaldepth],
133                [len,                    totaldepth],
134                [len,                    0]]);
135 //  }
136 }
137
138 module Cover(){
139   CoverTemplate();
140   CoverSide(minx,           covershortlen);
141   CoverSide(maxx-coverside, coverlonglen);
142 }
143
144 module Demo(){ ////toplevel
145   %Block();
146   DoKnives();
147   translate([0,0,-height])
148     rotate([90,0,0])
149       Cover();
150 }
151
152 Demo();