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