chiark / gitweb /
43870e61a6463260a6099302f55010b1b451d012
[reprap-play.git] / filamentspool.scad
1 // -*- C -*-
2
3 fdia=1.75;
4
5 slop=0.5;
6 bigslop=slop*2;
7
8 prongthick=5;
9 prongwidth=5;
10 ratchetstep=15;
11 ratchettooth=3;
12 ratchettoothheight=5;
13 ratchettoothsmoothr=1;
14 ratchettoothslope=0.75;
15 overlap=0.5;
16 cupbigrad=35;
17
18 doveclipheight = 10;
19
20 teethh=3;
21 teethgapx=4+fdia;
22
23 prongstalkxwidth=3;
24
25 stalklength=40;
26 overclipcupgap=5;
27 overclipdepth=15;
28 overcliproundr=2.0;
29 overclipthick=0.5;
30
31 wingspoke=3;
32 wingsize=6;
33 wingthick=3;
34
35 overclipsmaller=-1.0;
36 overclipbigger=2.0;
37
38 armendwallthick=2.5;
39 armendbasethick=1.2;
40
41 ratchetpawl=ratchetstep-ratchettooth-bigslop*2;
42
43 include <doveclip.scad>
44 include <cliphook.scad>
45 include <filamentteeth.scad>
46
47 channelwidth = prongthick + slop;
48 channeldepth = prongwidth + ratchettoothheight;
49 totalwidth = armendwallthick*2 + channelwidth;
50 totalheight = channeldepth + armendbasethick;
51 stalkwidth = prongwidth + prongstalkxwidth;
52
53 module ArmEnd(length=120){
54   translate([ratchettoothsmoothr, channelwidth/2, -armendbasethick]) {
55     rotate([0,0,-90])
56       DoveClipPairBase(h=doveclipheight);
57   }
58
59   difference(){
60     translate([0, -armendwallthick, -armendbasethick])
61       cube([length, totalwidth, totalheight]);
62     translate([-1, 0, 0])
63       cube([length+2, channelwidth, channeldepth+1]);
64   }
65   for (dx = [0 : ratchetstep : length - stalklength]) translate([dx,0,0]) {
66     translate([ratchettoothsmoothr+0.5, armendwallthick/2, 0]) minkowski(){
67       rotate([90,0,0])
68         cylinder($fn=20, r=ratchettoothsmoothr, h=armendwallthick);
69       multmatrix([      [       1, 0, ratchettoothslope, 0      ],
70                         [       0,      1,      0,      0       ],
71                         [       0,      0,      1,      0       ],
72                         [       0,      0,      0,      1       ]])
73         cube([ratchettooth - ratchettoothsmoothr*2,
74               channelwidth, ratchettoothheight]);
75     }
76   }
77 }
78
79 module FilamentCupHandle(){
80   pawlusewidth = ratchetpawl-ratchettoothsmoothr*2;
81   mirror([0,1,0]) {
82     cube([stalklength, stalkwidth, prongthick]);
83     translate([stalklength, stalkwidth/2, 0])
84       cylinder(r=stalkwidth/2, h=prongthick, $fn=20);
85     translate([ratchettoothsmoothr, stalkwidth, 0]) {
86       minkowski(){
87         cylinder($fn=20,r=ratchettoothsmoothr, h=1);
88         multmatrix([    [       1, -ratchettoothslope, 0, 0     ],
89                         [       0,      1,      0,      0       ],
90                         [       0,      0,      1,      0       ],
91                         [       0,      0,      0,      1       ]])
92           cube([pawlusewidth,
93                 ratchettoothheight - ratchettoothsmoothr,
94                 prongthick]);
95       }
96     }
97   }
98 }
99
100 module FilamentCupCup(){
101   xstraight = cupbigrad;
102   linear_extrude(height=prongthick) {
103     FlatArc(0,0, cupbigrad,cupbigrad+prongwidth, 89,271, $fn=80);
104   }
105   for (my=[0,1]) mirror([0,my,0]) {
106     translate([0,cupbigrad,0])
107       cube([xstraight, prongwidth, prongthick]);
108   }
109 }
110
111 module FilamentCup() {
112   FilamentCupHandle();
113
114   dx = cupbigrad + prongwidth;
115   gapy = prongwidth;
116   dy = cupbigrad + gapy + overclipcupgap;
117
118   translate([dx, dy, 0])
119     FilamentCupCup();
120   translate([0, -1, 0]);
121   cube([prongwidth, dy+1, prongthick]);
122
123   midrad = cupbigrad + prongwidth/2;
124
125   propshift = stalklength - overclipdepth - prongthick;
126   proptaken = propshift;
127   echo(cupbigrad, dx, midrad, propshift, proptaken);
128
129   translate([propshift, -1, 0]) {
130     cube([prongwidth,
131           dy - sqrt(midrad*midrad - proptaken*proptaken),
132           prongthick]);
133   }
134   translate([stalklength + overclipdepth, gapy, 0])
135     rotate([0,0,-(10 + fdia)])
136     FilamentTeeth(fdia=fdia, h=teethh);
137 }
138
139 module CupSecuringClipSolid(w,d,h1,h2){
140   rotate([0,-90,0]) translate([0,-h1/2,-w/2]) linear_extrude(height=w) {
141     polygon(points=[[0,0], [d,0], [d,h2], [0,h1]]);
142   }
143 }
144
145 module CupSecuringClipSolidSmooth(xrad=0, xdepth=0){
146   hbase = totalheight + prongstalkxwidth - overcliproundr*2;
147   minkowski(){
148     CupSecuringClipSolid(w=totalwidth,
149                          d=overclipdepth + xdepth,
150                          h1=hbase - overclipsmaller,
151                          h2=hbase + overclipbigger);
152     cylinder($fn=20, h=0.01, r=overcliproundr+xrad);
153   }
154 }
155
156 module CupSecuringClip(){
157   wingswidth = wingspoke*2 + overclipthick*2 + overcliproundr*2 + totalwidth;
158   difference(){
159     union(){
160       CupSecuringClipSolidSmooth(xrad=overclipthick, xdepth=0);
161       translate([-wingswidth/2, -wingsize/2, 0])
162         cube([wingswidth, wingsize, wingthick]);
163     }
164     translate([0,0,-0.1])
165       CupSecuringClipSolidSmooth(xrad=0, xdepth=5);
166   }
167 }
168
169 //ArmEnd();
170 //FilamentCup();
171 //CupSecuringClip();