chiark / gitweb /
f89befa21a08451b023e6100c33ce89d4d786cb7
[reprap-play.git] / filamentspool.scad
1 // -*- C -*-
2
3 fdia=2.85;
4
5 slop=0.5;
6 bigslop=slop*2;
7
8 exteffrad = 70;
9 hubeffrad = 30;
10 hubbigrad = 20;
11 hublwidth = 3;
12 hubstemwidth = 2;
13 hublthick = 10;
14 hubaxlelen = 25;
15 hubaxlerad = 5;
16 totalheightfromtower = 240;
17 axletowerfudgebend = 0;
18 axleaxlefudgebend = 3;
19 axlepadlen = 1.0;
20
21 function selsz(sm,lg) = fdia < 2 ? sm : lg;
22
23 prongthick=selsz(5,7);
24 prongwidth=selsz(5,7);
25 ratchetstep=15;
26 ratchettooth=3;
27 ratchettoothheight=5;
28 ratchettoothsmoothr=1;
29 ratchettoothslope=0.75;
30 overlap=0.5;
31 cupwidth=selsz(40,60);
32 cupheight=selsz(55,75);
33
34 propxshift = 0;
35
36 doveclipheight = 10;
37
38 teethh=3;
39 teethgapx=4+fdia;
40
41 prongstalkxwidth=3;
42
43 stalklength=selsz(35,55);
44 overclipcupgap=5;
45 overclipdepth=15;
46 overcliproundr=2.0;
47 overclipthick=0.5;
48 overclipcupnextgap=20;
49
50 overclipsmaller=-2.5;
51 overclipbigger=0.0;
52
53 wingspoke=3;
54 wingsize=6;
55 wingthick=3;
56
57 armendwallthick=2.5;
58 armendbasethick=1.2;
59
60 axlehorizoffset = 12.5;
61 axlevertheight = 100;
62 towercliph = 16;
63 towerclipcount = 3;
64 towerpillarw = 5;
65
66 axlepinrad = 2;
67 axlepintabrad = 5;
68
69 washerthick = 1.2;
70 washerthinthick = 0.8;
71 washerverythinthick = 0.4;
72 washerrad = hubaxlerad + 7.5;
73 frictionwasherarmwidth = 3;
74 frictionwasherextrapush = 1.0;
75
76 ratchetpawl=ratchetstep-ratchettooth-bigslop*2;
77
78 include <doveclip.scad>
79 include <cliphook.scad>
80 include <filamentteeth.scad>
81 include <axlepin.scad>
82
83 channelwidth = prongthick + slop;
84 channeldepth = prongwidth + ratchettoothheight;
85 totalwidth = armendwallthick*2 + channelwidth;
86 totalheight = channeldepth + armendbasethick;
87 stalkwidth = prongwidth + prongstalkxwidth;
88
89 module ArmEnd(length=120){ ////toplevel
90   translate([ratchettoothsmoothr, channelwidth/2, -armendbasethick]) {
91     rotate([0,0,-90])
92       DoveClipPairBase(h=doveclipheight);
93   }
94
95   difference(){
96     translate([0, -armendwallthick, -armendbasethick])
97       cube([length, totalwidth, totalheight]);
98     translate([-1, 0, 0])
99       cube([length+1 - ratchettooth, channelwidth, channeldepth+1]);
100     translate([-1, 0, ratchettoothheight])
101       cube([length+2, channelwidth, channeldepth+1]);
102   }
103   for (dx = [0 : ratchetstep : length - ratchetstep]) translate([dx,0,0]) {
104     translate([ratchettoothsmoothr+0.5, armendwallthick/2, 0]) minkowski(){
105       rotate([90,0,0])
106         cylinder($fn=20, r=ratchettoothsmoothr, h=armendwallthick);
107       multmatrix([      [       1, 0, ratchettoothslope, 0      ],
108                         [       0,      1,      0,      0       ],
109                         [       0,      0,      1,      0       ],
110                         [       0,      0,      0,      1       ]])
111         cube([ratchettooth - ratchettoothsmoothr*2,
112               channelwidth, ratchettoothheight - ratchettoothsmoothr]);
113     }
114   }
115 }
116
117 module FilamentCupHandle(){
118   pawlusewidth = ratchetpawl-ratchettoothsmoothr*2;
119   mirror([0,1,0]) {
120     cube([stalklength, stalkwidth, prongthick]);
121     translate([stalklength, stalkwidth/2, 0])
122       cylinder(r=stalkwidth/2, h=prongthick, $fn=20);
123     translate([ratchettoothsmoothr, stalkwidth, 0]) {
124       minkowski(){
125         cylinder($fn=20,r=ratchettoothsmoothr, h=1);
126         multmatrix([    [       1, -ratchettoothslope, 0, 0     ],
127                         [       0,      1,      0,      0       ],
128                         [       0,      0,      1,      0       ],
129                         [       0,      0,      0,      1       ]])
130           cube([pawlusewidth,
131                 ratchettoothheight - ratchettoothsmoothr,
132                 prongthick - 1]);
133       }
134     }
135   }
136 }
137
138 module FilamentCupCup(){
139   for (my=[0,1]) mirror([0,my,0]) {
140     translate([0,cupwidth/2,0])
141       cube([cupheight + prongwidth, prongwidth, prongthick]);
142   }
143 }
144
145 module FilamentCup() { ////toplevel
146   FilamentCupHandle();
147
148   gapy = prongwidth;
149   dy = cupwidth/2 + gapy + overclipcupgap;
150
151   translate([0, dy, 0])
152     FilamentCupCup();
153   translate([0, -1, 0]);
154   cube([prongwidth, dy+1+cupwidth/2, prongthick]);
155
156   midrad = cupwidth/2 + prongwidth/2;
157
158   propshift = stalklength - overclipdepth - prongthick + propxshift;
159   proptaken = propshift;
160   echo(midrad, propshift, proptaken);
161
162   translate([propshift, -1, 0]) {
163     // something is wrong with the y calculation
164     cube([prongwidth,
165           gapy+2,
166           prongthick]);
167   }
168   for (y = [overclipcupgap, overclipcupgap+overclipcupnextgap]) {
169     translate([0, y, 0])
170       rotate([0,0, 102 + fdia])
171       FilamentTeeth(fdia=fdia, h=teethh);
172   }
173   for (x = [-0.3, -1.3]) {
174     translate([cupheight + overclipcupnextgap*x, dy+cupwidth/2 + prongthick, 0])
175       rotate([0,0, 12 + fdia])
176       FilamentTeeth(fdia=fdia, h=teethh);
177   }      
178 }
179
180 module CupSecuringClipSolid(w,d,h1,h2){
181   rotate([0,-90,0]) translate([0,-h1/2,-w/2]) linear_extrude(height=w) {
182     polygon(points=[[0,0], [d,0], [d,h2], [0,h1]]);
183   }
184 }
185
186 module CupSecuringClipSolidSmooth(xrad=0, xdepth=0){
187   hbase = totalheight + prongstalkxwidth - overcliproundr*2;
188   minkowski(){
189     CupSecuringClipSolid(w=totalwidth,
190                          d=overclipdepth + xdepth,
191                          h1=hbase - overclipsmaller,
192                          h2=hbase + overclipbigger);
193     cylinder($fn=20, h=0.01, r=overcliproundr+xrad);
194   }
195 }
196
197 module CupSecuringClip(){ ////toplevel
198   wingswidth = wingspoke*2 + overclipthick*2 + overcliproundr*2 + totalwidth;
199   difference(){
200     union(){
201       CupSecuringClipSolidSmooth(xrad=overclipthick, xdepth=0);
202       translate([-wingswidth/2, -wingsize/2, 0])
203         cube([wingswidth, wingsize, wingthick]);
204     }
205     translate([0,0,-0.1])
206       CupSecuringClipSolidSmooth(xrad=0, xdepth=0.2);
207   }
208 }
209
210 module ArmDoveClipPin(){ ////toplevel
211   DoveClipPin(h=doveclipheight);
212 }
213
214 module TowerDoveClipPin(){ ////toplevel
215   DoveClipPin(h=towercliph/2);
216 }
217
218 module Hub(){ ////toplevel
219   difference(){
220     cylinder($fn=60, h=hublthick, r=hubbigrad);
221     translate([0,0,-1])
222       cylinder($fn=30, h=hublthick+2, r=(hubbigrad-hublwidth));
223   }
224   axlerad = hubaxlerad + slop;
225   difference(){
226     cylinder(h=hubaxlelen, r=axlerad+hublwidth);
227     translate([0,0,-1]) cylinder($fn=60, h=hubaxlelen+2, r=axlerad);
228   }
229   hole = hubeffrad - hubbigrad - DoveClip_depth() - hublwidth*2;
230   holewidth = DoveClipPairSane_width() - hubstemwidth*2;
231   for (ang=[0,120,240])
232     rotate([0,0,ang]) {
233       difference() {
234         translate([hubeffrad,0,0])
235           DoveClipPairSane(h=doveclipheight,
236                            baseextend = (hubeffrad - DoveClip_depth()
237                                          - hubbigrad + hublwidth));
238         if (hole>hublwidth && holewidth > 2) {
239           translate([hubbigrad + hublwidth, -holewidth/2, -1])
240             cube([hole, holewidth, hublthick+2]);
241         }
242       }
243     }
244   xmin = axlerad+hublwidth/2;
245   xmax = hubbigrad-hublwidth/2;
246   for (ang = [0 : 60 : 359])
247     rotate([0,0,ang]) rotate([90,0,0]) {
248       translate([0,0,-hublwidth/2])
249         linear_extrude(height=hublwidth)
250         polygon([[xmin,0.05], [xmax,0.05],
251                  [xmax,hublthick-0.2], [xmin, hubaxlelen-0.2]]);
252     }
253 }
254
255 module ArmExtender(){ ////toplevel
256   DoveClipExtender(length=exteffrad-hubeffrad,
257                    ha=doveclipheight,
258                    hb=doveclipheight);
259 }
260
261 module FsAxlePin(){ ////toplevel
262   AxlePin(hubaxlerad, washerrad*2, axlepinrad, axlepintabrad, slop);
263 }
264
265 module Axle(){ ////toplevel
266   pillarswidth = DoveClipPairSane_width(towerclipcount);
267
268   rotate([0,0, -( axleaxlefudgebend + atan(slop/hubaxlelen) ) ])
269   translate([-axlehorizoffset, -axlevertheight, 0]) {
270     rotate([0,0,-axletowerfudgebend])
271     rotate([0,0,-90])
272       DoveClipPairSane(h=towercliph, count=towerclipcount, baseextend=3);
273     translate([0, DoveClip_depth(), 0])
274     rotate([0,0,90])
275       ExtenderPillars(axlevertheight - DoveClip_depth(),
276                       pillarswidth, towercliph,
277                       pillarw=towerpillarw);
278   }
279
280   axleclearlen = hubaxlelen + slop*4 + washerthick*2 + axlepadlen;
281   axlerad = hubaxlerad-slop;
282   bump = axlerad * 0.2;
283   shift = axlerad-bump;
284   joinbelowallow = 3;
285
286   intersection(){
287     translate([0, 0, shift]) {
288       difference() {
289         union(){
290           translate([-1, 0, 0])
291             rotate([0,90,0])
292             cylinder($fn=60,
293                      r = axlerad,
294                      h = 1 + axleclearlen + axlepinrad*2 + 2);
295           mirror([1,0,0]) rotate([0,90,0])
296             cylinder(r = axlerad*1.75, h = 3);
297           intersection(){
298             mirror([1,0,0])
299               translate([axlehorizoffset - pillarswidth/2, 0, 0])
300               rotate([0,90,0])
301               cylinder($fn=60,
302                        r = towercliph - shift,
303                        h = pillarswidth);
304             translate([-50, -joinbelowallow, -50])
305               cube([100, joinbelowallow+50, 100]);
306           }
307         }
308         rotate([90,0,0])
309         translate([axleclearlen + axlepinrad/2, 0, -25])
310           cylinder(r = axlepinrad + slop, h=50);
311       }
312     }
313     translate([-50,-50,0]) cube([100,100,100]);
314   }
315 }
316
317 module washer(thick){
318   Washer(hubaxlerad, washerrad, thick, slop);
319 }
320
321 module AxleWasher(){ ////toplevel
322   washer(thick=washerthick);
323 }
324
325 module AxleThinWasher(){ ////toplevel
326   washer(thick=washerthinthick);
327 }
328
329 module AxleVeryThinWasher(){ ////toplevel
330   washer(thick=washerverythinthick);
331 }
332
333 module AxleFrictionWasher(){ ////toplevel
334   difference(){
335     cylinder(h=washerthick, r=washerrad);
336     translate([0,0,-1]) cylinder(h=washerthick+2, r=hubaxlerad+slop);
337   }
338   frarmr = hubbigrad;
339   frarmw = frictionwasherarmwidth;
340   frarmpawlr = hublwidth;
341   frarmpawlpush = slop*4 + frictionwasherextrapush;
342   for (ang=[0,180]) rotate([0,0,ang]) {
343     translate([washerrad-1, -frarmw/2, 0])
344       cube([frarmr - washerrad + 1, frarmw, washerthick]);
345     intersection(){
346       translate([frarmr - frarmpawlr, -50, 0])
347         cube([frarmpawlr, 100, 50]);
348       rotate([0,90,0])
349         cylinder(h = 50, r = frarmpawlpush, $fn=36);
350     }
351   }
352 }
353
354 module TowerExtender(){ ////toplevel
355   l = totalheightfromtower - axlevertheight;
356   echo("TowerExtender",l);
357   DoveClipExtender(length = l,
358                    ha = towercliph, hb = towercliph,
359                    counta = towerclipcount, countb = towerclipcount,
360                    pillarw = towerpillarw);
361 }
362
363 module FilamentCupPair(){ ////toplevel
364   FilamentCup();
365   translate([cupheight + prongthick*3,
366              cupwidth/2*1.7,
367              0])
368     rotate([0,0,180]) FilamentCup();
369 }
370
371 //ArmEnd();
372 //FilamentCup();
373 //FilamentCupPair();
374 CupSecuringClip();
375 //Hub();
376 //ArmExtender();
377 //Axle();
378 //AxleWasher();
379 //AxlePin();
380 //AxleFrictionWasher();