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