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