chiark / gitweb /
filamentspool wip axle
[reprap-play.git] / filamentspool.scad
1 // -*- C -*-
2
3 fdia=1.75;
4
5 slop=0.5;
6 bigslop=slop*2;
7
8 exteffrad = 85;
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 ratchetpawl=ratchetstep-ratchettooth-bigslop*2;
61
62 include <doveclip.scad>
63 include <cliphook.scad>
64 include <filamentteeth.scad>
65
66 channelwidth = prongthick + slop;
67 channeldepth = prongwidth + ratchettoothheight;
68 totalwidth = armendwallthick*2 + channelwidth;
69 totalheight = channeldepth + armendbasethick;
70 stalkwidth = prongwidth + prongstalkxwidth;
71
72 module ArmEnd(length=120){ ////toplevel
73   translate([ratchettoothsmoothr, channelwidth/2, -armendbasethick]) {
74     rotate([0,0,-90])
75       DoveClipPairBase(h=doveclipheight);
76   }
77
78   difference(){
79     translate([0, -armendwallthick, -armendbasethick])
80       cube([length, totalwidth, totalheight]);
81     translate([-1, 0, 0])
82       cube([length+1 - ratchettooth, channelwidth, channeldepth+1]);
83     translate([-1, 0, ratchettoothheight])
84       cube([length+2, channelwidth, channeldepth+1]);
85   }
86   for (dx = [0 : ratchetstep : length - ratchetstep]) translate([dx,0,0]) {
87     translate([ratchettoothsmoothr+0.5, armendwallthick/2, 0]) minkowski(){
88       rotate([90,0,0])
89         cylinder($fn=20, r=ratchettoothsmoothr, h=armendwallthick);
90       multmatrix([      [       1, 0, ratchettoothslope, 0      ],
91                         [       0,      1,      0,      0       ],
92                         [       0,      0,      1,      0       ],
93                         [       0,      0,      0,      1       ]])
94         cube([ratchettooth - ratchettoothsmoothr*2,
95               channelwidth, ratchettoothheight - ratchettoothsmoothr]);
96     }
97   }
98 }
99
100 module FilamentCupHandle(){
101   pawlusewidth = ratchetpawl-ratchettoothsmoothr*2;
102   mirror([0,1,0]) {
103     cube([stalklength, stalkwidth, prongthick]);
104     translate([stalklength, stalkwidth/2, 0])
105       cylinder(r=stalkwidth/2, h=prongthick, $fn=20);
106     translate([ratchettoothsmoothr, stalkwidth, 0]) {
107       minkowski(){
108         cylinder($fn=20,r=ratchettoothsmoothr, h=1);
109         multmatrix([    [       1, -ratchettoothslope, 0, 0     ],
110                         [       0,      1,      0,      0       ],
111                         [       0,      0,      1,      0       ],
112                         [       0,      0,      0,      1       ]])
113           cube([pawlusewidth,
114                 ratchettoothheight - ratchettoothsmoothr,
115                 prongthick - 1]);
116       }
117     }
118   }
119 }
120
121 module FilamentCupCup(){
122   xstraight = cupbigrad * xstraightmul;
123   linear_extrude(height=prongthick) {
124     FlatArc(0,0, cupbigrad,cupbigrad+prongwidth, 89,271, $fn=80);
125   }
126   for (my=[0,1]) mirror([0,my,0]) {
127     translate([0,cupbigrad,0])
128       cube([xstraight, prongwidth, prongthick]);
129   }
130 }
131
132 module FilamentCup() { ////toplevel
133   FilamentCupHandle();
134
135   dx = cupbigrad + prongwidth;
136   gapy = prongwidth;
137   dy = cupbigrad + gapy + overclipcupgap;
138
139   translate([dx, dy, 0])
140     FilamentCupCup();
141   translate([0, -1, 0]);
142   cube([prongwidth, dy+1, prongthick]);
143
144   midrad = cupbigrad + prongwidth/2;
145
146   propshift = stalklength - overclipdepth - prongthick + propxshift;
147   proptaken = propshift;
148   echo(cupbigrad, dx, midrad, propshift, proptaken);
149
150   translate([propshift, -1, 0]) {
151     // something is wrong with the y calculation
152     cube([prongwidth,
153           dy - sqrt(midrad*midrad - proptaken*proptaken) - prongwidth/2,
154           prongthick]);
155   }
156   translate([0, overclipcupgap, 0])
157     rotate([0,0, 102 + fdia])
158     FilamentTeeth(fdia=fdia, h=teethh);
159 }
160
161 module CupSecuringClipSolid(w,d,h1,h2){
162   rotate([0,-90,0]) translate([0,-h1/2,-w/2]) linear_extrude(height=w) {
163     polygon(points=[[0,0], [d,0], [d,h2], [0,h1]]);
164   }
165 }
166
167 module CupSecuringClipSolidSmooth(xrad=0, xdepth=0){
168   hbase = totalheight + prongstalkxwidth - overcliproundr*2;
169   minkowski(){
170     CupSecuringClipSolid(w=totalwidth,
171                          d=overclipdepth + xdepth,
172                          h1=hbase - overclipsmaller,
173                          h2=hbase + overclipbigger);
174     cylinder($fn=20, h=0.01, r=overcliproundr+xrad);
175   }
176 }
177
178 module CupSecuringClip(){ ////toplevel
179   wingswidth = wingspoke*2 + overclipthick*2 + overcliproundr*2 + totalwidth;
180   difference(){
181     union(){
182       CupSecuringClipSolidSmooth(xrad=overclipthick, xdepth=0);
183       translate([-wingswidth/2, -wingsize/2, 0])
184         cube([wingswidth, wingsize, wingthick]);
185     }
186     translate([0,0,-0.1])
187       CupSecuringClipSolidSmooth(xrad=0, xdepth=0.2);
188   }
189 }
190
191 module ArmDoveClipPin(){ ////toplevel
192   DoveClipPin(h=doveclipheight);
193 }
194
195 module Hub(){ ////toplevel
196   difference(){
197     cylinder($fn=60, h=hublthick, r=hubbigrad);
198     translate([0,0,-1])
199       cylinder($fn=30, h=hublthick+2, r=(hubbigrad-hublwidth));
200   }
201   axlerad = hubaxlerad + slop;
202   difference(){
203     cylinder(h=hubaxlelen, r=axlerad+hublwidth);
204     translate([0,0,-1]) cylinder($fn=60, h=hubaxlelen+2, r=axlerad);
205   }
206   hole = hubeffrad - hubbigrad - DoveClip_depth() - hublwidth*2;
207   holewidth = DoveClipPairSane_width() - hubstemwidth*2;
208   for (ang=[0,120,240])
209     rotate([0,0,ang]) {
210       difference() {
211         translate([hubeffrad,0,0])
212           DoveClipPairSane(h=doveclipheight,
213                            baseextend = (hubeffrad - DoveClip_depth()
214                                          - hubbigrad + hublwidth));
215         if (hole>hublwidth && holewidth > 2) {
216           translate([hubbigrad + hublwidth, -holewidth/2, -1])
217             cube([hole, holewidth, hublthick+2]);
218         }
219       }
220     }
221   xmin = axlerad+hublwidth/2;
222   xmax = hubbigrad-hublwidth/2;
223   for (ang = [0 : 60 : 359])
224     rotate([0,0,ang]) rotate([90,0,0]) {
225       translate([0,0,-hublwidth/2])
226         linear_extrude(height=hublwidth)
227         polygon([[xmin,0.05], [xmax,0.05],
228                  [xmax,hublthick-0.2], [xmin, hubaxlelen-0.2]]);
229     }
230 }
231
232 module ArmExtender(){ ////toplevel
233   DoveClipExtender(length=exteffrad-hubeffrad,
234                    ha=doveclipheight,
235                    hb=doveclipheight);
236 }
237
238 module Axle(){ ////toplevel
239   pillarswidth = DoveClipPairSane_width(towerclipcount);
240
241   translate([-axlehorizoffset, -axlevertheight, 0]) {
242     rotate([0,0,-90])
243       DoveClipPairSane(h=towercliph, count=towerclipcount, baseextend=3);
244     translate([0, DoveClip_depth(), 0])
245     rotate([0,0,90])
246       ExtenderPillars(axlevertheight - DoveClip_depth(),
247                       pillarswidth, towercliph,
248                       pillarw=towerpillarw);
249   }
250 }
251
252 //ArmEnd();
253 //FilamentCup();
254 //CupSecuringClip();
255 //Hub();
256 //ArmExtender();
257 Axle();