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