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