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