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