chiark / gitweb /
filamentspool: More clips
[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 cupwidth=40;
30 cupheight=55;
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 overclipcupnextgap=20;
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   for (my=[0,1]) mirror([0,my,0]) {
138     translate([0,cupwidth/2,0])
139       cube([cupheight + prongwidth, prongwidth, prongthick]);
140   }
141 }
142
143 module FilamentCup() { ////toplevel
144   FilamentCupHandle();
145
146   gapy = prongwidth;
147   dy = cupwidth/2 + gapy + overclipcupgap;
148
149   translate([0, dy, 0])
150     FilamentCupCup();
151   translate([0, -1, 0]);
152   cube([prongwidth, dy+1+cupwidth/2, prongthick]);
153
154   midrad = cupwidth/2 + prongwidth/2;
155
156   propshift = stalklength - overclipdepth - prongthick + propxshift;
157   proptaken = propshift;
158   echo(midrad, propshift, proptaken);
159
160   translate([propshift, -1, 0]) {
161     // something is wrong with the y calculation
162     cube([prongwidth,
163           gapy+2,
164           prongthick]);
165   }
166   for (y = [overclipcupgap, overclipcupgap+overclipcupnextgap]) {
167     translate([0, y, 0])
168       rotate([0,0, 102 + fdia])
169       FilamentTeeth(fdia=fdia, h=teethh);
170   }
171   for (x = [-0.3, -1.3]) {
172     translate([cupheight + overclipcupnextgap*x, dy+cupwidth/2 + prongthick, 0])
173       rotate([0,0, 12 + fdia])
174       FilamentTeeth(fdia=fdia, h=teethh);
175   }      
176 }
177
178 module CupSecuringClipSolid(w,d,h1,h2){
179   rotate([0,-90,0]) translate([0,-h1/2,-w/2]) linear_extrude(height=w) {
180     polygon(points=[[0,0], [d,0], [d,h2], [0,h1]]);
181   }
182 }
183
184 module CupSecuringClipSolidSmooth(xrad=0, xdepth=0){
185   hbase = totalheight + prongstalkxwidth - overcliproundr*2;
186   minkowski(){
187     CupSecuringClipSolid(w=totalwidth,
188                          d=overclipdepth + xdepth,
189                          h1=hbase - overclipsmaller,
190                          h2=hbase + overclipbigger);
191     cylinder($fn=20, h=0.01, r=overcliproundr+xrad);
192   }
193 }
194
195 module CupSecuringClip(){ ////toplevel
196   wingswidth = wingspoke*2 + overclipthick*2 + overcliproundr*2 + totalwidth;
197   difference(){
198     union(){
199       CupSecuringClipSolidSmooth(xrad=overclipthick, xdepth=0);
200       translate([-wingswidth/2, -wingsize/2, 0])
201         cube([wingswidth, wingsize, wingthick]);
202     }
203     translate([0,0,-0.1])
204       CupSecuringClipSolidSmooth(xrad=0, xdepth=0.2);
205   }
206 }
207
208 module ArmDoveClipPin(){ ////toplevel
209   DoveClipPin(h=doveclipheight);
210 }
211
212 module TowerDoveClipPin(){ ////toplevel
213   DoveClipPin(h=towercliph/2);
214 }
215
216 module Hub(){ ////toplevel
217   difference(){
218     cylinder($fn=60, h=hublthick, r=hubbigrad);
219     translate([0,0,-1])
220       cylinder($fn=30, h=hublthick+2, r=(hubbigrad-hublwidth));
221   }
222   axlerad = hubaxlerad + slop;
223   difference(){
224     cylinder(h=hubaxlelen, r=axlerad+hublwidth);
225     translate([0,0,-1]) cylinder($fn=60, h=hubaxlelen+2, r=axlerad);
226   }
227   hole = hubeffrad - hubbigrad - DoveClip_depth() - hublwidth*2;
228   holewidth = DoveClipPairSane_width() - hubstemwidth*2;
229   for (ang=[0,120,240])
230     rotate([0,0,ang]) {
231       difference() {
232         translate([hubeffrad,0,0])
233           DoveClipPairSane(h=doveclipheight,
234                            baseextend = (hubeffrad - DoveClip_depth()
235                                          - hubbigrad + hublwidth));
236         if (hole>hublwidth && holewidth > 2) {
237           translate([hubbigrad + hublwidth, -holewidth/2, -1])
238             cube([hole, holewidth, hublthick+2]);
239         }
240       }
241     }
242   xmin = axlerad+hublwidth/2;
243   xmax = hubbigrad-hublwidth/2;
244   for (ang = [0 : 60 : 359])
245     rotate([0,0,ang]) rotate([90,0,0]) {
246       translate([0,0,-hublwidth/2])
247         linear_extrude(height=hublwidth)
248         polygon([[xmin,0.05], [xmax,0.05],
249                  [xmax,hublthick-0.2], [xmin, hubaxlelen-0.2]]);
250     }
251 }
252
253 module ArmExtender(){ ////toplevel
254   DoveClipExtender(length=exteffrad-hubeffrad,
255                    ha=doveclipheight,
256                    hb=doveclipheight);
257 }
258
259 module FsAxlePin(){ ////toplevel
260   AxlePin(hubaxlerad, washerrad*2, axlepinrad, axlepintabrad, slop);
261 }
262
263 module Axle(){ ////toplevel
264   pillarswidth = DoveClipPairSane_width(towerclipcount);
265
266   rotate([0,0, -( axleaxlefudgebend + atan(slop/hubaxlelen) ) ])
267   translate([-axlehorizoffset, -axlevertheight, 0]) {
268     rotate([0,0,-axletowerfudgebend])
269     rotate([0,0,-90])
270       DoveClipPairSane(h=towercliph, count=towerclipcount, baseextend=3);
271     translate([0, DoveClip_depth(), 0])
272     rotate([0,0,90])
273       ExtenderPillars(axlevertheight - DoveClip_depth(),
274                       pillarswidth, towercliph,
275                       pillarw=towerpillarw);
276   }
277
278   axleclearlen = hubaxlelen + slop*4 + washerthick*2 + axlepadlen;
279   axlerad = hubaxlerad-slop;
280   bump = axlerad * 0.2;
281   shift = axlerad-bump;
282   joinbelowallow = 3;
283
284   intersection(){
285     translate([0, 0, shift]) {
286       difference() {
287         union(){
288           translate([-1, 0, 0])
289             rotate([0,90,0])
290             cylinder($fn=60,
291                      r = axlerad,
292                      h = 1 + axleclearlen + axlepinrad*2 + 2);
293           mirror([1,0,0]) rotate([0,90,0])
294             cylinder(r = axlerad*1.75, h = 3);
295           intersection(){
296             mirror([1,0,0])
297               translate([axlehorizoffset - pillarswidth/2, 0, 0])
298               rotate([0,90,0])
299               cylinder($fn=60,
300                        r = towercliph - shift,
301                        h = pillarswidth);
302             translate([-50, -joinbelowallow, -50])
303               cube([100, joinbelowallow+50, 100]);
304           }
305         }
306         rotate([90,0,0])
307         translate([axleclearlen + axlepinrad/2, 0, -25])
308           cylinder(r = axlepinrad + slop, h=50);
309       }
310     }
311     translate([-50,-50,0]) cube([100,100,100]);
312   }
313 }
314
315 module washer(thick){
316   Washer(hubaxlerad, washerrad, thick, slop);
317 }
318
319 module AxleWasher(){ ////toplevel
320   washer(thick=washerthick);
321 }
322
323 module AxleThinWasher(){ ////toplevel
324   washer(thick=washerthinthick);
325 }
326
327 module AxleVeryThinWasher(){ ////toplevel
328   washer(thick=washerverythinthick);
329 }
330
331 module AxleFrictionWasher(){ ////toplevel
332   difference(){
333     cylinder(h=washerthick, r=washerrad);
334     translate([0,0,-1]) cylinder(h=washerthick+2, r=hubaxlerad+slop);
335   }
336   frarmr = hubbigrad;
337   frarmw = frictionwasherarmwidth;
338   frarmpawlr = hublwidth;
339   frarmpawlpush = slop*4 + frictionwasherextrapush;
340   for (ang=[0,180]) rotate([0,0,ang]) {
341     translate([washerrad-1, -frarmw/2, 0])
342       cube([frarmr - washerrad + 1, frarmw, washerthick]);
343     intersection(){
344       translate([frarmr - frarmpawlr, -50, 0])
345         cube([frarmpawlr, 100, 50]);
346       rotate([0,90,0])
347         cylinder(h = 50, r = frarmpawlpush, $fn=36);
348     }
349   }
350 }
351
352 module TowerExtender(){ ////toplevel
353   l = totalheightfromtower - axlevertheight;
354   echo("TowerExtender",l);
355   DoveClipExtender(length = l,
356                    ha = towercliph, hb = towercliph,
357                    counta = towerclipcount, countb = towerclipcount,
358                    pillarw = towerpillarw);
359 }
360
361 module FilamentCupPair(){ ////toplevel
362   FilamentCup();
363   translate([cupheight + prongthick*3,
364              cupwidth/2*1.7,
365              0])
366     rotate([0,0,180]) FilamentCup();
367 }
368
369 //ArmEnd();
370 //FilamentCup();
371 FilamentCupPair();
372 //CupSecuringClip();
373 //Hub();
374 //ArmExtender();
375 //Axle();
376 //AxleWasher();
377 //AxlePin();
378 //AxleFrictionWasher();