chiark / gitweb /
tower-base for head test, more
[reprap-play.git] / filamentspool.scad
1 // -*- C -*-
2
3 fdia=1.75;
4
5 slop=0.5;
6 bigslop=slop*2;
7
8 hubeffrad = 30;
9 hubbigrad = 20;
10 hublwidth = 4;
11 hublthick = 10;
12 hubaxlelen = 25;
13 hubaxlerad = 5;
14
15 prongthick=5;
16 prongwidth=5;
17 ratchetstep=15;
18 ratchettooth=3;
19 ratchettoothheight=5;
20 ratchettoothsmoothr=1;
21 ratchettoothslope=0.75;
22 overlap=0.5;
23 cupbigrad=20;
24
25 xstraightmul = 1.75;
26
27 propxshift = 0;
28
29 doveclipheight = 10;
30
31 teethh=3;
32 teethgapx=4+fdia;
33
34 prongstalkxwidth=3;
35
36 stalklength=35;
37 overclipcupgap=5;
38 overclipdepth=15;
39 overcliproundr=2.0;
40 overclipthick=0.5;
41
42 overclipsmaller=-2.5;
43 overclipbigger=0.0;
44
45 wingspoke=3;
46 wingsize=6;
47 wingthick=3;
48
49 armendwallthick=2.5;
50 armendbasethick=1.2;
51
52 ratchetpawl=ratchetstep-ratchettooth-bigslop*2;
53
54 include <doveclip.scad>
55 include <cliphook.scad>
56 include <filamentteeth.scad>
57
58 channelwidth = prongthick + slop;
59 channeldepth = prongwidth + ratchettoothheight;
60 totalwidth = armendwallthick*2 + channelwidth;
61 totalheight = channeldepth + armendbasethick;
62 stalkwidth = prongwidth + prongstalkxwidth;
63
64 module ArmEnd(length=120){
65   translate([ratchettoothsmoothr, channelwidth/2, -armendbasethick]) {
66     rotate([0,0,-90])
67       DoveClipPairBase(h=doveclipheight);
68   }
69
70   difference(){
71     translate([0, -armendwallthick, -armendbasethick])
72       cube([length, totalwidth, totalheight]);
73     translate([-1, 0, 0])
74       cube([length+1 - ratchettooth, channelwidth, channeldepth+1]);
75     translate([-1, 0, ratchettoothheight])
76       cube([length+2, channelwidth, channeldepth+1]);
77   }
78   for (dx = [0 : ratchetstep : length - ratchetstep]) translate([dx,0,0]) {
79     translate([ratchettoothsmoothr+0.5, armendwallthick/2, 0]) minkowski(){
80       rotate([90,0,0])
81         cylinder($fn=20, r=ratchettoothsmoothr, h=armendwallthick);
82       multmatrix([      [       1, 0, ratchettoothslope, 0      ],
83                         [       0,      1,      0,      0       ],
84                         [       0,      0,      1,      0       ],
85                         [       0,      0,      0,      1       ]])
86         cube([ratchettooth - ratchettoothsmoothr*2,
87               channelwidth, ratchettoothheight - ratchettoothsmoothr]);
88     }
89   }
90 }
91
92 module FilamentCupHandle(){
93   pawlusewidth = ratchetpawl-ratchettoothsmoothr*2;
94   mirror([0,1,0]) {
95     cube([stalklength, stalkwidth, prongthick]);
96     translate([stalklength, stalkwidth/2, 0])
97       cylinder(r=stalkwidth/2, h=prongthick, $fn=20);
98     translate([ratchettoothsmoothr, stalkwidth, 0]) {
99       minkowski(){
100         cylinder($fn=20,r=ratchettoothsmoothr, h=1);
101         multmatrix([    [       1, -ratchettoothslope, 0, 0     ],
102                         [       0,      1,      0,      0       ],
103                         [       0,      0,      1,      0       ],
104                         [       0,      0,      0,      1       ]])
105           cube([pawlusewidth,
106                 ratchettoothheight - ratchettoothsmoothr,
107                 prongthick - 1]);
108       }
109     }
110   }
111 }
112
113 module FilamentCupCup(){
114   xstraight = cupbigrad * xstraightmul;
115   linear_extrude(height=prongthick) {
116     FlatArc(0,0, cupbigrad,cupbigrad+prongwidth, 89,271, $fn=80);
117   }
118   for (my=[0,1]) mirror([0,my,0]) {
119     translate([0,cupbigrad,0])
120       cube([xstraight, prongwidth, prongthick]);
121   }
122 }
123
124 module FilamentCup() {
125   FilamentCupHandle();
126
127   dx = cupbigrad + prongwidth;
128   gapy = prongwidth;
129   dy = cupbigrad + gapy + overclipcupgap;
130
131   translate([dx, dy, 0])
132     FilamentCupCup();
133   translate([0, -1, 0]);
134   cube([prongwidth, dy+1, prongthick]);
135
136   midrad = cupbigrad + prongwidth/2;
137
138   propshift = stalklength - overclipdepth - prongthick + propxshift;
139   proptaken = propshift;
140   echo(cupbigrad, dx, midrad, propshift, proptaken);
141
142   translate([propshift, -1, 0]) {
143     // something is wrong with the y calculation
144     cube([prongwidth,
145           dy - sqrt(midrad*midrad - proptaken*proptaken) - prongwidth/2,
146           prongthick]);
147   }
148   translate([0, overclipcupgap, 0])
149     rotate([0,0, 102 + fdia])
150     FilamentTeeth(fdia=fdia, h=teethh);
151 }
152
153 module CupSecuringClipSolid(w,d,h1,h2){
154   rotate([0,-90,0]) translate([0,-h1/2,-w/2]) linear_extrude(height=w) {
155     polygon(points=[[0,0], [d,0], [d,h2], [0,h1]]);
156   }
157 }
158
159 module CupSecuringClipSolidSmooth(xrad=0, xdepth=0){
160   hbase = totalheight + prongstalkxwidth - overcliproundr*2;
161   minkowski(){
162     CupSecuringClipSolid(w=totalwidth,
163                          d=overclipdepth + xdepth,
164                          h1=hbase - overclipsmaller,
165                          h2=hbase + overclipbigger);
166     cylinder($fn=20, h=0.01, r=overcliproundr+xrad);
167   }
168 }
169
170 module CupSecuringClip(){
171   wingswidth = wingspoke*2 + overclipthick*2 + overcliproundr*2 + totalwidth;
172   difference(){
173     union(){
174       CupSecuringClipSolidSmooth(xrad=overclipthick, xdepth=0);
175       translate([-wingswidth/2, -wingsize/2, 0])
176         cube([wingswidth, wingsize, wingthick]);
177     }
178     translate([0,0,-0.1])
179       CupSecuringClipSolidSmooth(xrad=0, xdepth=0.2);
180   }
181 }
182
183 module ArmDoveClipPin(){
184   DoveClipPin(h=doveclipheight);
185 }
186
187 module Hub(){
188   difference(){
189     cylinder(h=hublthick, r=hubbigrad);
190     translate([0,0,-1]) cylinder(h=hublthick+2, r=(hubbigrad-hublwidth));
191   }
192   axlerad = hubaxlerad + slop;
193   difference(){
194     cylinder(h=hubaxlelen, r=axlerad+hublwidth);
195     translate([0,0,-1]) cylinder(h=hubaxlelen+2, r=axlerad);
196   }
197   for (ang=[0,120,240])
198     rotate([0,0,ang]) {
199       translate([hubeffrad,0,0])
200         DoveClipPairSane(h=doveclipheight,
201                          baseextend = (hubeffrad - DoveClip_depth()
202                                        - hubbigrad + hublwidth));
203     }
204   xmin = axlerad+hublwidth/2;
205   xmax = hubbigrad-hublwidth/2;
206   for (ang = [0 : 60 : 359])
207     rotate([0,0,ang]) rotate([90,0,0]) {
208       translate([0,0,-hublwidth/2])
209         linear_extrude(height=hublwidth)
210         polygon([[xmin,0], [xmax,0], [xmax,hublthick], [xmin,hubaxlelen]]);
211     }
212 }
213
214 //ArmEnd();
215 //FilamentCup();
216 //CupSecuringClip();