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