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