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