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