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