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