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