summaryrefslogtreecommitdiffabout
path: root/fanduct.scad
Unidiff
Diffstat (limited to 'fanduct.scad') (more/less context) (ignore whitespace changes)
-rw-r--r--fanduct.scad4
1 files changed, 2 insertions, 2 deletions
diff --git a/fanduct.scad b/fanduct.scad
index 2bc5623..efc6a19 100644
--- a/fanduct.scad
+++ b/fanduct.scad
@@ -1,495 +1,495 @@
1use <snapper.scad>; 1use <snapper.scad>;
2 extrusion_width=.5; layer_height=.2; // print parameters 2 extrusion_width=.5; layer_height=.2; // print parameters
3 3
4 epsilon=.005; // for finer cuts 4 epsilon=.005; // for finer cuts
5 5
6 type="simple"; // circular|3jets 6 type="jets"; // jets|circular|simple
7 ductshape="square"; // square|round 7 ductshape="square"; // square|round
8 dual=true; // dual or single 8 dual=true; // dual or single
9 9
10 nozzles_apart = 18; // distance between nozzles for dual hotend 10 nozzles_apart = 18; // distance between nozzles for dual hotend
11 space_behind_nozzle = 10;// space behind the nozzle where we're allowed to go 11 space_behind_nozzle = 10;// space behind the nozzle where we're allowed to go
12 // without the fear of hitting carriage 12 // without the fear of hitting carriage
13 13
14 inlet_w = 12.5; // inlet width 14 inlet_w = 12.5; // inlet width
15 inlet_h = 17; // inlet height 15 inlet_h = 17; // inlet height
16 inlet_short_l = 7;// inlet length of protrusion (or depth of intrusion:)) 16 inlet_short_l = 7;// inlet length of protrusion (or depth of intrusion:))
17 inlet_away = 15;// how far away inlet is 17 inlet_away = 15;// how far away inlet is
18 18
19inlet_long_l = inlet_short_l+inlet_h; 19inlet_long_l = inlet_short_l+inlet_h;
20function hypothenuse(a,b) = sqrt(pow(a,2)+pow(b,2)); 20function hypothenuse(a,b) = sqrt(pow(a,2)+pow(b,2));
21 21
22silicone_shell = 2; 22silicone_shell = 2;
23heater_clearance = dual 23heater_clearance = dual
24 ? max(20,15.5) - 4.5 + silicone_shell 24 ? max(20,15.5) - 4.5 + silicone_shell
25 : max( 25 : max(
26 hypothenuse(16/2 +silicone_shell, 20-4.5 +silicone_shell),// E3D v6 26 hypothenuse(16/2 +silicone_shell, 20-4.5 +silicone_shell),// E3D v6
27 hypothenuse(11.5-4.5 +silicone_shell, 15.5 +silicone_shell)// E3D volcano 27 hypothenuse(11.5-4.5 +silicone_shell, 15.5 +silicone_shell)// E3D volcano
28 ); 28 );
29 29
30 fanduct_elevation = 3; // fanduct elevation above nozzle tip 30 fanduct_elevation = 3; // fanduct elevation above nozzle tip
31 fanduct_blowtarget = -2; // what to blow at 31 fanduct_blowtarget = -2; // what to blow at
32 fanduct_h = 6; // inner height of the duct 32 fanduct_h = 6; // inner height of the duct
33 fanduct_w = 7; // inner width of the duct 33 fanduct_w = 7; // inner width of the duct
34 fanduct_shell=1.2; // shell thickness 34 fanduct_shell=1.2; // shell thickness
35 fanduct_ir = heater_clearance+5; // inner radius 35 fanduct_ir = heater_clearance+5; // inner radius
36 36
37 jet_angle = 60-2; // angular width of the jet 37 jet_angle = 60-2; // angular width of the jet
38 38
39hotend_clearance = heater_clearance; 39hotend_clearance = heater_clearance;
40 40
41 snapper_d = 8; snapper_overlap=0.2;// snip snap 41 snapper_d = 8; snapper_overlap=0.2;// snip snap
42 42
43draft=true; 43draft=true;
44smooth_f = draft? 30 : 120; 44smooth_f = draft? 30 : 120;
45 45
46to_midduct = fanduct_ir+fanduct_shell+fanduct_w/2; 46to_midduct = fanduct_ir+fanduct_shell+fanduct_w/2;
47dual_spots = [ [+space_behind_nozzle, -(to_midduct+nozzles_apart/2)], 47dual_spots = [ [+space_behind_nozzle, -(to_midduct+nozzles_apart/2)],
48 [- to_midduct, -(to_midduct+nozzles_apart/2)], 48 [- to_midduct, -(to_midduct+nozzles_apart/2)],
49 [- to_midduct, 0] ]; 49 [- to_midduct, 0] ];
50 50
51module fanduct(type=type,ductshape=ductshape,dual=dual) { 51module fanduct(type=type,ductshape=ductshape,dual=dual) {
52 // ***duct is all around! 52 // ***duct is all around!
53 53
54 module duct(what) { 54 module duct(what) {
55 module ductshape(what,sh,sv,r) { 55 module ductshape(what,sh,sv,r) {
56 smax = max(sh,sv); 56 smax = max(sh,sv);
57 translate([what=="in"?0:fanduct_shell,what=="in"?0:fanduct_shell]) 57 translate([what=="in"?0:fanduct_shell,what=="in"?0:fanduct_shell])
58 if(ductshape=="round") { 58 if(ductshape=="round") {
59 translate([sh/2+r,sv/2]) 59 translate([sh/2+r,sv/2])
60 scale([sh/smax,sv/smax]) 60 scale([sh/smax,sv/smax])
61 circle(d=smax,$fn=4*smax); 61 circle(d=smax,$fn=4*smax);
62 }else if(ductshape=="square") { 62 }else if(ductshape=="square") {
63 translate([r,0]) 63 translate([r,0])
64 if(what=="in") 64 if(what=="in")
65 square([sh,sv]); 65 square([sh,sv]);
66 else if(what=="out") union() { 66 else if(what=="out") union() {
67 square([sh,sv/2]); 67 square([sh,sv/2]);
68 translate([sh/2,sv/2]) 68 translate([sh/2,sv/2])
69 scale([sh/smax,sv/smax]) 69 scale([sh/smax,sv/smax])
70 circle(d=smax,$fn=4*smax); 70 circle(d=smax,$fn=4*smax);
71 } 71 }
72 } 72 }
73 } 73 }
74 module single() { 74 module single() {
75 if(what=="in") { 75 if(what=="in") {
76 sh = fanduct_w+2*fanduct_shell; sv = fanduct_h+2*fanduct_shell; 76 sh = fanduct_w+2*fanduct_shell; sv = fanduct_h+2*fanduct_shell;
77 rotate_extrude($fn=smooth_f) 77 rotate_extrude($fn=smooth_f)
78 ductshape(what=what,sh=sh,sv=sv,r=fanduct_ir); 78 ductshape(what=what,sh=sh,sv=sv,r=fanduct_ir);
79 }else if(what=="out") { 79 }else if(what=="out") {
80 sh = fanduct_w; sv = fanduct_h; 80 sh = fanduct_w; sv = fanduct_h;
81 smax = max(sh,sv); 81 smax = max(sh,sv);
82 rotate_extrude($fn=smooth_f) 82 rotate_extrude($fn=smooth_f)
83 ductshape(what=what,sh=sh,sv=sv,r=fanduct_ir); 83 ductshape(what=what,sh=sh,sv=sv,r=fanduct_ir);
84 } 84 }
85 } 85 }
86 module dual() { 86 module dual() {
87 module hulls(spots=dual_spots) { 87 module hulls(spots=dual_spots) {
88 for(my=[0,1]) mirror([0,my,0]) for(pn=[0:1:len(spots)-2]) hull() { 88 for(my=[0,1]) mirror([0,my,0]) for(pn=[0:1:len(spots)-2]) hull() {
89 for(p=[spots[pn],spots[pn+1]]) translate(p) children(); 89 for(p=[spots[pn],spots[pn+1]]) translate(p) children();
90 } 90 }
91 } 91 }
92 if(what=="in") { 92 if(what=="in") {
93 hulls() cylinder(d=fanduct_w+2*fanduct_shell,h=fanduct_h+2*fanduct_shell); 93 hulls() cylinder(d=fanduct_w+2*fanduct_shell,h=fanduct_h+2*fanduct_shell);
94 }else if(what=="out") { 94 }else if(what=="out") {
95 sh = fanduct_w; sv = fanduct_h; 95 sh = fanduct_w; sv = fanduct_h;
96 smax = max(sh,sv); 96 smax = max(sh,sv);
97 translate([0,0,fanduct_shell]) hulls() { 97 translate([0,0,fanduct_shell]) hulls() {
98 cylinder(d=fanduct_w,h=fanduct_h/2); 98 cylinder(d=fanduct_w,h=fanduct_h/2);
99 translate([0,0,fanduct_h/2]) 99 translate([0,0,fanduct_h/2])
100 scale([sh/smax,sh/smax,sv/smax]) 100 scale([sh/smax,sh/smax,sv/smax])
101 intersection() { 101 intersection() {
102 sphere(d=smax,$fn=36); 102 sphere(d=smax,$fn=36);
103 translate([0,0,-1]) 103 translate([0,0,-1])
104 cylinder(d=smax+2,h=smax+2,$fn=36); 104 cylinder(d=smax+2,h=smax+2,$fn=36);
105 } 105 }
106 } 106 }
107 } 107 }
108 } 108 }
109 module dual_simple() { 109 module dual_simple() {
110 for(my=[0,1]) mirror([0,my,0]) 110 for(my=[0,1]) mirror([0,my,0])
111 if(what=="in") { 111 if(what=="in") {
112 sh = fanduct_w+2*fanduct_shell; sv = fanduct_h+2*fanduct_shell; 112 sh = fanduct_w+2*fanduct_shell; sv = fanduct_h+2*fanduct_shell;
113 translate([0,nozzles_apart/2,0]) 113 translate([0,nozzles_apart/2,0])
114 intersection() { 114 intersection() {
115 rotate_extrude($fn=smooth_f) 115 rotate_extrude($fn=smooth_f)
116 translate([fanduct_ir,0]) square([sh,sv]); 116 translate([fanduct_ir,0]) square([sh,sv]);
117 translate([-fanduct_ir-sh-1,0,-1]) 117 translate([-fanduct_ir-sh-1,0,-1])
118 cube(size=[fanduct_ir+sh+2,fanduct_ir+sh+2,sv+2]); 118 cube(size=[fanduct_ir+sh+2,fanduct_ir+sh+2,sv+2]);
119 } 119 }
120 translate([-fanduct_ir-sh,-epsilon,0]) 120 translate([-fanduct_ir-sh,-epsilon,0])
121 cube(size=[sh,nozzles_apart/2+2*epsilon,sv]); 121 cube(size=[sh,nozzles_apart/2+2*epsilon,sv]);
122 translate([0,sh/2+fanduct_ir+nozzles_apart/2,0]) cylinder(d=sh,h=sv,$fn=36); 122 translate([0,sh/2+fanduct_ir+nozzles_apart/2,0]) cylinder(d=sh,h=sv,$fn=36);
123 }else if(what=="out") { 123 }else if(what=="out") {
124 sh = fanduct_w; sv = fanduct_h; 124 sh = fanduct_w; sv = fanduct_h;
125 translate([0,nozzles_apart/2,fanduct_shell]) 125 translate([0,nozzles_apart/2,fanduct_shell])
126 intersection() { 126 intersection() {
127 rotate_extrude($fn=smooth_f) 127 rotate_extrude($fn=smooth_f)
128 translate([fanduct_ir+fanduct_shell,0]) square([sh,sv]); 128 translate([fanduct_ir+fanduct_shell,0]) square([sh,sv]);
129 translate([-fanduct_ir-2*fanduct_shell-sh-1,-1,0]) 129 translate([-fanduct_ir-2*fanduct_shell-sh-1,-1,0])
130 cube(size=[fanduct_ir+2*fanduct_shell+sh+2,fanduct_ir+2*fanduct_shell+sh+2,sv]); 130 cube(size=[fanduct_ir+2*fanduct_shell+sh+2,fanduct_ir+2*fanduct_shell+sh+2,sv]);
131 } 131 }
132 translate([-fanduct_ir-fanduct_shell-sh,-epsilon,fanduct_shell]) 132 translate([-fanduct_ir-fanduct_shell-sh,-epsilon,fanduct_shell])
133 cube(size=[sh,nozzles_apart/2+2*epsilon,sv]); 133 cube(size=[sh,nozzles_apart/2+2*epsilon,sv]);
134 translate([0,sh/2+fanduct_shell+fanduct_ir+nozzles_apart/2,fanduct_shell]) 134 translate([0,sh/2+fanduct_shell+fanduct_ir+nozzles_apart/2,fanduct_shell])
135 cylinder(d=sh,h=sv,$fn=36); 135 cylinder(d=sh,h=sv,$fn=36);
136 } 136 }
137 } 137 }
138 module dual_complex() { 138 module dual_complex() {
139 for(my=[0,1]) mirror([0,my,0]) 139 for(my=[0,1]) mirror([0,my,0])
140 if(what=="in") { 140 if(what=="in") {
141 sh = fanduct_w+2*fanduct_shell; 141 sh = fanduct_w+2*fanduct_shell;
142 sv = fanduct_h+2*fanduct_shell; 142 sv = fanduct_h+2*fanduct_shell;
143 for(mx=[0,1]) mirror([mx,0,0]) 143 for(mx=[0,1]) mirror([mx,0,0])
144 mirror([0,1,0]) rotate([90,0,0]) 144 mirror([0,1,0]) rotate([90,0,0])
145 translate([0,0,-1]) 145 translate([0,0,-1])
146 linear_extrude(height=nozzles_apart/2+1+epsilon) 146 linear_extrude(height=nozzles_apart/2+1+epsilon)
147 ductshape(sh=sh,sv=sv,r=fanduct_ir,what=what); 147 ductshape(sh=sh,sv=sv,r=fanduct_ir,what=what);
148 translate([0,nozzles_apart/2,0]) 148 translate([0,nozzles_apart/2,0])
149 difference() { 149 difference() {
150 rotate_extrude($fn=smooth_f) 150 rotate_extrude($fn=smooth_f)
151 ductshape(sh=sh,sv=sv,r=fanduct_ir,what=what); 151 ductshape(sh=sh,sv=sv,r=fanduct_ir,what=what);
152 mirror([0,1,0]) translate([-fanduct_ir-sh-1,0,-1]) 152 mirror([0,1,0]) translate([-fanduct_ir-sh-1,0,-1])
153 cube(size=[2*(fanduct_ir+sh+1),fanduct_ir+sh+1,sv+2]); 153 cube(size=[2*(fanduct_ir+sh+1),fanduct_ir+sh+1,sv+2]);
154 } 154 }
155 }else{ 155 }else{
156 sh = fanduct_w; sv = fanduct_h; 156 sh = fanduct_w; sv = fanduct_h;
157 for(mx=[0,1]) mirror([mx,0,0]) 157 for(mx=[0,1]) mirror([mx,0,0])
158 mirror([0,1,0]) rotate([90,0,0]) 158 mirror([0,1,0]) rotate([90,0,0])
159 translate([0,0,-1]) 159 translate([0,0,-1])
160 linear_extrude(height=nozzles_apart/2+1+epsilon) 160 linear_extrude(height=nozzles_apart/2+1+epsilon)
161 ductshape(sh=sh,sv=sv,r=fanduct_ir,what=what); 161 ductshape(sh=sh,sv=sv,r=fanduct_ir,what=what);
162 translate([0,nozzles_apart/2,0]) 162 translate([0,nozzles_apart/2,0])
163 difference() { 163 difference() {
164 rotate_extrude($fn=smooth_f) 164 rotate_extrude($fn=smooth_f)
165 ductshape(sh=sh,sv=sv,r=fanduct_ir,what=what); 165 ductshape(sh=sh,sv=sv,r=fanduct_ir,what=what);
166 mirror([0,1,0]) translate([-fanduct_ir-sh-1,0,-1]) 166 mirror([0,1,0]) translate([-fanduct_ir-sh-1,0,-1])
167 cube(size=[2*(fanduct_ir+sh+1),fanduct_ir+sh+1,sv+2]); 167 cube(size=[2*(fanduct_ir+sh+1),fanduct_ir+sh+1,sv+2]);
168 } 168 }
169 } 169 }
170 } 170 }
171 171
172 if(dual) { 172 if(dual) {
173 if(type=="simple") 173 if(type=="simple")
174 dual_simple(); 174 dual_simple();
175 else if(type=="jets") 175 else if(type=="jets")
176 dual_complex(); 176 dual_complex();
177 else dual(); 177 else dual();
178 }else single(); 178 }else single();
179 } 179 }
180 180
181 // ***bumps for easier position adjustments in line with hotend 181 // ***bumps for easier position adjustments in line with hotend
182 module marks(what) { 182 module marks(what) {
183 if(what=="in") { 183 if(what=="in") {
184 for(y=[-1,1]) translate([0,dual?y*nozzles_apart/2:0,0]) 184 for(y=[-1,1]) translate([0,dual?y*nozzles_apart/2:0,0])
185 hull() for(z=[0,-fanduct_shell-fanduct_h/2]) 185 hull() for(z=[0,-fanduct_shell-fanduct_h/2])
186 translate([0,y*(fanduct_ir+fanduct_shell+fanduct_w/2),fanduct_shell*2+fanduct_h+z]) 186 translate([0,y*(fanduct_ir+fanduct_shell+fanduct_w/2),fanduct_shell*2+fanduct_h+z])
187 rotate([90,0,0]) { 187 rotate([90,0,0]) {
188 cylinder(r=fanduct_shell,h=fanduct_w,center=true,$fn=30); 188 cylinder(r=fanduct_shell,h=fanduct_w,center=true,$fn=30);
189 for(z=[-1,1]) translate([0,0,z*fanduct_w/2]) 189 for(z=[-1,1]) translate([0,0,z*fanduct_w/2])
190 sphere(r=fanduct_shell,$fn=30); 190 sphere(r=fanduct_shell,$fn=30);
191 } 191 }
192 } 192 }
193 } 193 }
194 194
195 // ***output 195 // ***output
196 module output(what,type=type) { 196 module output(what,type=type) {
197 module guideline(xyxy) { 197 module guideline(xyxy) {
198 module pin(xy) { 198 module pin(xy) {
199 translate([xy[0],xy[1],0]) 199 translate([xy[0],xy[1],0])
200 cylinder(d=2*extrusion_width,h=2*fanduct_shell+inlet_h,$fn=6); 200 cylinder(d=2*extrusion_width,h=2*fanduct_shell+inlet_h,$fn=6);
201 } 201 }
202 xyxyxy=concat(xyxy,[[0,dual?nozzles_apart/2:0]]); 202 xyxyxy=concat(xyxy,[[0,dual?nozzles_apart/2:0]]);
203 for(i=[0:1:len(xyxyxy)-2]) 203 for(i=[0:1:len(xyxyxy)-2])
204 hull() for(j=[i,i+1]) pin(xyxyxy[j]); 204 hull() for(j=[i,i+1]) pin(xyxyxy[j]);
205 } 205 }
206 206
207 module circus(what) { 207 module circus(what) {
208 if(what=="in") { 208 if(what=="in") {
209 difference() { 209 difference() {
210 rotate_extrude($fn=smooth_f) 210 rotate_extrude($fn=smooth_f)
211 polygon([ 211 polygon([
212 [0,-fanduct_elevation+fanduct_blowtarget+epsilon], 212 [0,-fanduct_elevation+fanduct_blowtarget+epsilon],
213 [fanduct_ir+fanduct_shell,fanduct_shell+fanduct_h/2], 213 [fanduct_ir+fanduct_shell,fanduct_shell+fanduct_h/2],
214 [fanduct_ir+fanduct_shell+fanduct_w/2,0], 214 [fanduct_ir+fanduct_shell+fanduct_w/2,0],
215 [0,-fanduct_elevation+fanduct_blowtarget-epsilon]]); 215 [0,-fanduct_elevation+fanduct_blowtarget-epsilon]]);
216 translate([0,0,-1]) 216 translate([0,0,-1])
217 cylinder(r=hotend_clearance,h=fanduct_h+2*fanduct_shell+2,$fn=smooth_f); 217 cylinder(r=hotend_clearance,h=fanduct_h+2*fanduct_shell+2,$fn=smooth_f);
218 mirror([0,0,1]) 218 mirror([0,0,1])
219 translate([0,0,-epsilon]) 219 translate([0,0,-epsilon])
220 cylinder(r=fanduct_ir+2*fanduct_shell+fanduct_w+1,h=fanduct_elevation+.1+2); 220 cylinder(r=fanduct_ir+2*fanduct_shell+fanduct_w+1,h=fanduct_elevation+.1+2);
221 } 221 }
222 }else if(what=="out") { 222 }else if(what=="out") {
223 rotate_extrude($fn=smooth_f) 223 rotate_extrude($fn=smooth_f)
224 polygon([ 224 polygon([
225 [0,-fanduct_elevation+fanduct_blowtarget+epsilon], 225 [0,-fanduct_elevation+fanduct_blowtarget+epsilon],
226 [fanduct_ir+fanduct_shell+1,fanduct_h/2], 226 [fanduct_ir+fanduct_shell+1,fanduct_h/2],
227 [fanduct_ir+fanduct_w/2+fanduct_shell+1,fanduct_shell], 227 [fanduct_ir+fanduct_w/2+fanduct_shell+1,fanduct_shell],
228 [0,-fanduct_elevation+fanduct_blowtarget-epsilon]]); 228 [0,-fanduct_elevation+fanduct_blowtarget-epsilon]]);
229 }else if(what=="airguides") { 229 }else if(what=="airguides") {
230 inr = fanduct_ir+fanduct_shell; our = inr+fanduct_w; 230 inr = fanduct_ir+fanduct_shell; our = inr+fanduct_w;
231 union() { 231 union() {
232 for(my=[0,1]) mirror([0,my,0]) { 232 for(my=[0,1]) mirror([0,my,0]) {
233 guideline([ 233 guideline([
234 [-our,inlet_w/6], 234 [-our,inlet_w/6],
235 [-inr*sin(60),inr*cos(60)] 235 [-inr*sin(60),inr*cos(60)]
236 ]); 236 ]);
237 a0=30; as=15; a1=180; 237 a0=30; as=15; a1=180;
238 for(a=[a0+as:as:a1]) { 238 for(a=[a0+as:as:a1]) {
239 f = as/(a1-a+as); 239 f = as/(a1-a+as);
240 rotate([0,0,a]) guideline([[-inr-fanduct_w*f,0]]); 240 rotate([0,0,a]) guideline([[-inr-fanduct_w*f,0]]);
241 } 241 }
242 guideline([ 242 guideline([
243 [-our+fanduct_w*cos(30)*3/4,fanduct_w*sin(30)*3/4], 243 [-our+fanduct_w*cos(30)*3/4,fanduct_w*sin(30)*3/4],
244 [-inr*cos(10),inr*sin(10)] 244 [-inr*cos(10),inr*sin(10)]
245 ]); 245 ]);
246 } 246 }
247 }/*union*/ 247 }/*union*/
248 }/*airguides*/ 248 }/*airguides*/
249 } 249 }
250 250
251 module jets(what) { 251 module jets(what) {
252 od = fanduct_h*2/3+fanduct_shell; 252 od = fanduct_h*2/3+fanduct_shell;
253 md = fanduct_ir+fanduct_shell+fanduct_w/2; 253 md = fanduct_ir+fanduct_shell+fanduct_w/2;
254 jww = 2*md*sin(jet_angle/2); 254 jww = 2*md*sin(jet_angle/2);
255 difference() { 255 difference() {
256 for(a=[0:120:359]) rotate([0,0,a]) { 256 for(a=[0:120:359]) rotate([0,0,a]) {
257 if(what=="in") { 257 if(what=="in") {
258 hull() { 258 hull() {
259 intersection() { 259 intersection() {
260 translate([md-fanduct_w/2,-jww/2,0]) 260 translate([md-fanduct_w/2,-jww/2,0])
261 cube(size=[fanduct_shell+fanduct_w/2,jww,od]); 261 cube(size=[fanduct_shell+fanduct_w/2,jww,od]);
262 duct(what=what); 262 duct(what=what);
263 } 263 }
264 translate([0,0,-fanduct_elevation]) sphere(r=.5); 264 translate([0,0,-fanduct_elevation]) sphere(r=.5);
265 } 265 }
266 }else if(what=="out") { 266 }else if(what=="out") {
267 hull() { 267 hull() {
268 intersection() { 268 intersection() {
269 translate([md-fanduct_w/2,-jww/2+fanduct_shell,fanduct_shell]) 269 translate([md-fanduct_w/2,-jww/2+fanduct_shell,fanduct_shell])
270 cube(size=[fanduct_w/2,jww-2*fanduct_shell,od-2*fanduct_shell]); 270 cube(size=[fanduct_w/2,jww-2*fanduct_shell,od-2*fanduct_shell]);
271 duct(what=what); 271 duct(what=what);
272 } 272 }
273 translate([0,0,-fanduct_elevation]) sphere(r=.2); 273 translate([0,0,-fanduct_elevation]) sphere(r=.2);
274 } 274 }
275 } 275 }
276 } 276 }
277 if(what=="in") { 277 if(what=="in") {
278 translate([0,0,-fanduct_elevation-2+epsilon]) 278 translate([0,0,-fanduct_elevation-2+epsilon])
279 cylinder(r=fanduct_ir+fanduct_shell*2+fanduct_w+1,h=fanduct_elevation+2); 279 cylinder(r=fanduct_ir+fanduct_shell*2+fanduct_w+1,h=fanduct_elevation+2);
280 translate([0,0,-hotend_clearance]) 280 translate([0,0,-hotend_clearance])
281 rotate([0,0,30]) 281 rotate([0,0,30])
282 cylinder(r1=hotend_clearance*2,r2=0,h=hotend_clearance*2,$fn=6); 282 cylinder(r1=hotend_clearance*2,r2=0,h=hotend_clearance*2,$fn=6);
283 } 283 }
284 } 284 }
285 } 285 }
286 286
287 module dual(what=what) { 287 module dual(what=what) {
288 module hulls(spots=dual_spots) { 288 module hulls(spots=dual_spots) {
289 for(my=[0,1]) mirror([0,my,0]) for(pn=[0:1:len(spots)-2]) hull() { 289 for(my=[0,1]) mirror([0,my,0]) for(pn=[0:1:len(spots)-2]) hull() {
290 for(p=[spots[pn],spots[pn+1]]) translate(p) children(0); 290 for(p=[spots[pn],spots[pn+1]]) translate(p) children(0);
291 children([1:$children-1]); 291 children([1:$children-1]);
292 } 292 }
293 } 293 }
294 if(what=="in") { 294 if(what=="in") {
295 cfn= 4; // clearance cutout $fn 295 cfn= 4; // clearance cutout $fn
296 difference() { 296 difference() {
297 hulls() { 297 hulls() {
298 cylinder(d=fanduct_w+2*fanduct_shell,h=2*fanduct_shell+fanduct_h/2); 298 cylinder(d=fanduct_w+2*fanduct_shell,h=2*fanduct_shell+fanduct_h/2);
299 translate([0,-nozzles_apart/2,-fanduct_elevation-fanduct_blowtarget]) sphere(d=.1); 299 translate([0,-nozzles_apart/2,-fanduct_elevation-fanduct_blowtarget]) sphere(d=.1);
300 } 300 }
301 translate([0,0,epsilon]) hull() for(my=[0:1]) mirror([0,my,0]) for(s=dual_spots) translate(s) 301 translate([0,0,epsilon]) hull() for(my=[0:1]) mirror([0,my,0]) for(s=dual_spots) translate(s)
302 mirror([0,0,1]) cylinder(d=fanduct_w+2*fanduct_shell+2,h=fanduct_elevation-fanduct_blowtarget+1); 302 mirror([0,0,1]) cylinder(d=fanduct_w+2*fanduct_shell+2,h=fanduct_elevation-fanduct_blowtarget+1);
303 for(s=[-1,1]) translate([0,s*nozzles_apart/2,-1]) 303 for(s=[-1,1]) translate([0,s*nozzles_apart/2,-1])
304 rotate([0,0,180/cfn]) cylinder(r=hotend_clearance/cos(180/cfn),h=fanduct_h+2*fanduct_shell+2,$fn=cfn); 304 rotate([0,0,180/cfn]) cylinder(r=hotend_clearance/cos(180/cfn),h=fanduct_h+2*fanduct_shell+2,$fn=cfn);
305 } 305 }
306 }else if(what=="out") { 306 }else if(what=="out") {
307 hulls() { 307 hulls() {
308 translate([0,0,fanduct_shell]) cylinder(d=fanduct_w,h=fanduct_h/2-fanduct_shell/2); 308 translate([0,0,fanduct_shell]) cylinder(d=fanduct_w,h=fanduct_h/2-fanduct_shell/2);
309 translate([0,-nozzles_apart/2,-fanduct_elevation+fanduct_blowtarget]) sphere(d=.1); 309 translate([0,-nozzles_apart/2,-fanduct_elevation+fanduct_blowtarget]) sphere(d=.1);
310 } 310 }
311 }else if(what=="airguides") { 311 }else if(what=="airguides") {
312 far = fanduct_ir+fanduct_shell+fanduct_w; 312 far = fanduct_ir+fanduct_shell+fanduct_w;
313 near = fanduct_ir; 313 near = fanduct_ir;
314 union() { 314 union() {
315 for(my=[0,1]) mirror([0,my,0]) { 315 for(my=[0,1]) mirror([0,my,0]) {
316 guideline([ [-far ,0], [0, nozzles_apart/8] ]); 316 guideline([ [-far ,0], [0, nozzles_apart/8] ]);
317 guideline([ [-far ,inlet_w/2/4 ], 317 guideline([ [-far ,inlet_w/2/4 ],
318 [-near ,to_midduct/2] ]); 318 [-near ,to_midduct/2] ]);
319 guideline([ [-near-fanduct_w/3, to_midduct/2 ], 319 guideline([ [-near-fanduct_w/3, to_midduct/2 ],
320 [-near ,nozzles_apart/2+near ] ]); 320 [-near ,nozzles_apart/2+near ] ]);
321 guideline([ [0 ,nozzles_apart/2+near+fanduct_w*space_behind_nozzle/to_midduct] ]); 321 guideline([ [0 ,nozzles_apart/2+near+fanduct_w*space_behind_nozzle/to_midduct] ]);
322 } 322 }
323 } 323 }
324 } 324 }
325 } 325 }
326 326
327 module dual_jets(what=what) { 327 module dual_jets(what=what) {
328 od=fanduct_h*2/3+fanduct_shell; 328 od=fanduct_h*2/3+fanduct_shell;
329 md=fanduct_ir+fanduct_shell+fanduct_w/2; 329 md=fanduct_ir+fanduct_shell+fanduct_w/2;
330 jww = 2*md*sin(jet_angle/2); 330 jww = 2*md*sin(jet_angle/2);
331 difference() { 331 difference() {
332 for(my=[0,1]) mirror([0,my,0]) 332 for(my=[0,1]) mirror([0,my,0])
333 translate([0,nozzles_apart/2,0]) 333 translate([0,nozzles_apart/2,0])
334 for(a=[45,135]) rotate([0,0,a]) 334 for(a=[45,135]) rotate([0,0,a])
335 if(what=="in") { 335 if(what=="in") {
336 hull() { 336 hull() {
337 intersection() { 337 intersection() {
338 translate([md-fanduct_w/2,-jww/2,0]) 338 translate([md-fanduct_w/2,-jww/2,0])
339 cube(size=[fanduct_shell+fanduct_w/2,jww,od]); 339 cube(size=[fanduct_shell+fanduct_w/2,jww,od]);
340 rotate([0,0,-a]) translate([0,-nozzles_apart/2,0]) duct(what=what); 340 rotate([0,0,-a]) translate([0,-nozzles_apart/2,0]) duct(what=what);
341 } // intersection 341 } // intersection
342 translate([0,0,-fanduct_elevation]) sphere(r=.5); 342 translate([0,0,-fanduct_elevation]) sphere(r=.5);
343 } // hull 343 } // hull
344 }else if(what=="out") { 344 }else if(what=="out") {
345 hull() { 345 hull() {
346 intersection() { 346 intersection() {
347 translate([md-fanduct_w/2,-jww/2+fanduct_shell,fanduct_shell]) 347 translate([md-fanduct_w/2,-jww/2+fanduct_shell,fanduct_shell])
348 cube(size=[fanduct_w/2,jww-2*fanduct_shell,od-2*fanduct_shell]); 348 cube(size=[fanduct_w/2,jww-2*fanduct_shell,od-2*fanduct_shell]);
349 rotate([0,0,-a]) translate([0,-nozzles_apart/2,0]) duct(what=what); 349 rotate([0,0,-a]) translate([0,-nozzles_apart/2,0]) duct(what=what);
350 } // intersection 350 } // intersection
351 translate([0,0,-fanduct_elevation]) sphere(r=.5); 351 translate([0,0,-fanduct_elevation]) sphere(r=.5);
352 } // hull 352 } // hull
353 } // what=="out" 353 } // what=="out"
354 if(what=="in") { 354 if(what=="in") {
355 translate([0,0,-fanduct_elevation/2-1+epsilon]) 355 translate([0,0,-fanduct_elevation/2-1+epsilon])
356 cube(size=[2*(fanduct_ir+2*fanduct_shell+fanduct_w+1),nozzles_apart+2*(fanduct_ir+2*fanduct_shell+fanduct_w+1),fanduct_elevation+2],center=true); 356 cube(size=[2*(fanduct_ir+2*fanduct_shell+fanduct_w+1),nozzles_apart+2*(fanduct_ir+2*fanduct_shell+fanduct_w+1),fanduct_elevation+2],center=true);
357 for(my=[0,1]) mirror([0,my,0]) 357 for(my=[0,1]) mirror([0,my,0])
358 translate([0,nozzles_apart/2,-hotend_clearance]) 358 translate([0,nozzles_apart/2,-hotend_clearance])
359 cylinder(r1=hotend_clearance*2,r2=0,h=hotend_clearance*2,$fn=4); 359 cylinder(r1=hotend_clearance*2,r2=0,h=hotend_clearance*2,$fn=4);
360 } 360 }
361 } // difference 361 } // difference
362 } 362 }
363 363
364 module dual_simple(what=what) { 364 module dual_simple(what=what) {
365 for(my=[0:1]) mirror([0,my,0]) if(what=="in") { 365 for(my=[0:1]) mirror([0,my,0]) if(what=="in") {
366 difference() { 366 difference() {
367 hull() { 367 hull() {
368 translate([0,nozzles_apart/2+fanduct_ir+fanduct_shell+fanduct_w/2,0]) 368 translate([0,nozzles_apart/2+fanduct_ir+fanduct_shell+fanduct_w/2,0])
369 cylinder(d=fanduct_w+2*fanduct_shell,h=fanduct_h*2/3+2*fanduct_shell); 369 cylinder(d=fanduct_w+2*fanduct_shell,h=fanduct_h*2/3+2*fanduct_shell);
370 translate([0,nozzles_apart/2,-fanduct_elevation+fanduct_blowtarget]) 370 translate([0,nozzles_apart/2,-fanduct_elevation+fanduct_blowtarget])
371 rotate([0,90,0]) cylinder(r=.5,h=fanduct_w*2,center=true); 371 rotate([0,90,0]) cylinder(r=.5,h=fanduct_w*2,center=true);
372 } 372 }
373 rr = 2*(fanduct_ir+fanduct_shell*2+fanduct_w+2); 373 rr = 2*(fanduct_ir+fanduct_shell*2+fanduct_w+2);
374 translate([-rr/2,0,0]) mirror([0,0,1]) cube(size=[rr,rr,rr]); 374 translate([-rr/2,0,0]) mirror([0,0,1]) cube(size=[rr,rr,rr]);
375 } 375 }
376 }else if(what=="out") { 376 }else if(what=="out") {
377 hull() { 377 hull() {
378 translate([0,nozzles_apart/2+fanduct_ir+fanduct_shell+fanduct_w/2,fanduct_shell]) 378 translate([0,nozzles_apart/2+fanduct_ir+fanduct_shell+fanduct_w/2,fanduct_shell])
379 cylinder(d=fanduct_w,h=fanduct_h*2/3); 379 cylinder(d=fanduct_w,h=fanduct_h*2/3);
380 translate([0,nozzles_apart/2,-fanduct_elevation+fanduct_blowtarget]) 380 translate([0,nozzles_apart/2,-fanduct_elevation+fanduct_blowtarget])
381 rotate([0,90,0]) cylinder(d=.5,h=fanduct_w*2,center=true); 381 rotate([0,90,0]) cylinder(d=.5,h=fanduct_w*2,center=true);
382 } 382 }
383 } 383 }
384 } 384 }
385 385
386 if(dual) { 386 if(dual) {
387 if(type=="simple") dual_simple(what); 387 if(type=="simple") dual_simple(what);
388 else if(type=="jets") dual_jets(what); 388 else if(type=="jets") dual_jets(what);
389 else dual(what); 389 else dual(what);
390 }else if(type=="circular") circus(what); 390 }else if(type=="circular") circus(what);
391 else if(type=="3jets") jets(what); 391 else if(type=="jets") jets(what);
392 } 392 }
393 393
394 // ***air intake 394 // ***air intake
395 module intake(what) { 395 module intake(what) {
396 module placeit() { 396 module placeit() {
397 translate([-fanduct_ir-2*fanduct_shell-fanduct_w-inlet_away,0,fanduct_shell]) 397 translate([-fanduct_ir-2*fanduct_shell-fanduct_w-inlet_away,0,fanduct_shell])
398 rotate([0,-90,0]) 398 rotate([0,-90,0])
399 children(); 399 children();
400 } 400 }
401 if(what=="in") { 401 if(what=="in") {
402 placeit() translate([0,-inlet_w/2,0]) { 402 placeit() translate([0,-inlet_w/2,0]) {
403 difference() { 403 difference() {
404 cube(size=[inlet_h,inlet_w,inlet_long_l+fanduct_shell]); translate([inlet_h+fanduct_shell,0,inlet_long_l+fanduct_shell]) 404 cube(size=[inlet_h,inlet_w,inlet_long_l+fanduct_shell]); translate([inlet_h+fanduct_shell,0,inlet_long_l+fanduct_shell])
405 rotate([-90,0,0]) 405 rotate([-90,0,0])
406 translate([0,0,-1]) 406 translate([0,0,-1])
407 cylinder(r=inlet_h,h=inlet_w+2*fanduct_shell+2,$fn=inlet_h*4); 407 cylinder(r=inlet_h,h=inlet_w+2*fanduct_shell+2,$fn=inlet_h*4);
408 } 408 }
409 // supports 409 // supports
410 for(i=[-1,0,1]) 410 for(i=[-1,0,1])
411 translate([-fanduct_shell, 411 translate([-fanduct_shell,
412 (i+1)*(inlet_w-extrusion_width)/2, 412 (i+1)*(inlet_w-extrusion_width)/2,
413 -inlet_away-fanduct_w/2]) 413 -inlet_away-fanduct_w/2])
414 cube(size=[fanduct_shell+1, 414 cube(size=[fanduct_shell+1,
415 extrusion_width, 415 extrusion_width,
416 inlet_long_l+fanduct_shell+inlet_away+fanduct_w/2]); 416 inlet_long_l+fanduct_shell+inlet_away+fanduct_w/2]);
417 } 417 }
418 hull() { 418 hull() {
419 placeit() translate([-fanduct_shell,-inlet_w/2-fanduct_shell,0]) 419 placeit() translate([-fanduct_shell,-inlet_w/2-fanduct_shell,0])
420 cube(size=[inlet_h+2*fanduct_shell,inlet_w+2*fanduct_shell,fanduct_shell]); 420 cube(size=[inlet_h+2*fanduct_shell,inlet_w+2*fanduct_shell,fanduct_shell]);
421 translate([-fanduct_ir-fanduct_shell-fanduct_w/2,0,0]) 421 translate([-fanduct_ir-fanduct_shell-fanduct_w/2,0,0])
422 translate([0,-inlet_w/2-fanduct_shell/2,0]) 422 translate([0,-inlet_w/2-fanduct_shell/2,0])
423 cube(size=[1,inlet_w+fanduct_shell,fanduct_shell*2+fanduct_h]); 423 cube(size=[1,inlet_w+fanduct_shell,fanduct_shell*2+fanduct_h]);
424 } 424 }
425 }else if(what=="out") { 425 }else if(what=="out") {
426 placeit() translate([fanduct_shell,-inlet_w/2+fanduct_shell,0]) 426 placeit() translate([fanduct_shell,-inlet_w/2+fanduct_shell,0])
427 cube(size=[inlet_h-2*fanduct_shell,inlet_w-2*fanduct_shell,inlet_long_l+fanduct_shell+1]); 427 cube(size=[inlet_h-2*fanduct_shell,inlet_w-2*fanduct_shell,inlet_long_l+fanduct_shell+1]);
428 hull() { 428 hull() {
429 placeit() translate([fanduct_shell,-inlet_w/2+fanduct_shell,0]) 429 placeit() translate([fanduct_shell,-inlet_w/2+fanduct_shell,0])
430 cube(size=[inlet_h-2*fanduct_shell,inlet_w-2*fanduct_shell,fanduct_shell]); 430 cube(size=[inlet_h-2*fanduct_shell,inlet_w-2*fanduct_shell,fanduct_shell]);
431 translate([-fanduct_ir-fanduct_shell-fanduct_w/2,0,fanduct_shell]) 431 translate([-fanduct_ir-fanduct_shell-fanduct_w/2,0,fanduct_shell])
432 translate([0,-inlet_w/2+fanduct_shell,0]) 432 translate([0,-inlet_w/2+fanduct_shell,0])
433 cube(size=[1,inlet_w-2*fanduct_shell,fanduct_h]); 433 cube(size=[1,inlet_w-2*fanduct_shell,fanduct_h]);
434 } 434 }
435 } 435 }
436 } 436 }
437 437
438 // ***DUCT TAILS!!! WOO-OO! (every day they're out there making duct tails…) 438 // ***DUCT TAILS!!! WOO-OO! (every day they're out there making duct tails…)
439 module tails(what) { 439 module tails(what) {
440 if(dual && type=="simple") { 440 if(dual && type=="simple") {
441 // XXX: not sure if it will ever be 441 // XXX: not sure if it will ever be
442 }else{ 442 }else{
443 if(what=="in") { 443 if(what=="in") {
444 for(mx=[0,1]) mirror([mx,0,0]) 444 for(mx=[0,1]) mirror([mx,0,0])
445 translate([fanduct_ir+fanduct_shell+fanduct_w/2,0,fanduct_shell+fanduct_h/2]) 445 translate([fanduct_ir+fanduct_shell+fanduct_w/2,0,fanduct_shell+fanduct_h/2])
446 rotate([90,0,90]) 446 rotate([90,0,90])
447 translate([0,0,-snapper_d/2]) 447 translate([0,0,-snapper_d/2])
448 snapper(d=snapper_d,o=snapper_overlap,side=0,l=fanduct_h*3/2+fanduct_shell); 448 snapper(d=snapper_d,o=snapper_overlap,side=0,l=fanduct_h*3/2+fanduct_shell);
449 } 449 }
450 } 450 }
451 } 451 }
452 452
453 module parts(what) { 453 module parts(what) {
454 union() { 454 union() {
455 duct(what); 455 duct(what);
456 marks(what); 456 marks(what);
457 output(what); 457 output(what);
458 intake(what); 458 intake(what);
459 tails(what); 459 tails(what);
460 } 460 }
461 } 461 }
462 462
463 difference() { 463 difference() {
464 parts("in"); 464 parts("in");
465 parts("out"); 465 parts("out");
466 } 466 }
467 intersection() { 467 intersection() {
468 union() { 468 union() {
469 output("airguides"); 469 output("airguides");
470 sphere(d=epsilon); 470 sphere(d=epsilon);
471 } 471 }
472 union() { 472 union() {
473 duct("in"); output("in"); intake("in"); 473 duct("in"); output("in"); intake("in");
474 } 474 }
475 } 475 }
476} 476}
477 477
478view="*"; // hcut|vcut|* 478view="*"; // hcut|vcut|*
479 479
480hinfinity=4*(fanduct_ir+fanduct_shell*2+fanduct_w+inlet_away); 480hinfinity=4*(fanduct_ir+fanduct_shell*2+fanduct_w+inlet_away);
481vinfinity=2*(fanduct_shell*2+fanduct_h+inlet_h); 481vinfinity=2*(fanduct_shell*2+fanduct_h+inlet_h);
482if(view=="hcut") { 482if(view=="hcut") {
483 difference() { 483 difference() {
484 fanduct(); 484 fanduct();
485 translate([-hinfinity/2,-hinfinity/2,fanduct_shell+fanduct_h/2]) 485 translate([-hinfinity/2,-hinfinity/2,fanduct_shell+fanduct_h/2])
486 cube(size=[hinfinity,hinfinity,vinfinity]); 486 cube(size=[hinfinity,hinfinity,vinfinity]);
487 } 487 }
488}else if(view=="vcut") { 488}else if(view=="vcut") {
489 difference() { 489 difference() {
490 fanduct(); 490 fanduct();
491 translate([-hinfinity/2,0,-vinfinity/2]) 491 translate([-hinfinity/2,0,-vinfinity/2])
492 cube(size=[hinfinity,hinfinity,vinfinity]); 492 cube(size=[hinfinity,hinfinity,vinfinity]);
493 } 493 }
494}else fanduct(); 494}else fanduct();
495/* vim:set sw=1 ai: */ 495/* vim:set sw=1 ai: */