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