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