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