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