summaryrefslogtreecommitdiffabout
path: root/fanduct.scad
Unidiff
Diffstat (limited to 'fanduct.scad') (more/less context) (ignore whitespace changes)
-rw-r--r--fanduct.scad66
1 files changed, 61 insertions, 5 deletions
diff --git a/fanduct.scad b/fanduct.scad
index 52aee0e..a17b261 100644
--- a/fanduct.scad
+++ b/fanduct.scad
@@ -1,364 +1,420 @@
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="circular"; // circular|3jets 6 type="simple"; // circular|3jets
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 module duct(what) { 53 module duct(what) {
54 module single() { 54 module single() {
55 if(what=="in") { 55 if(what=="in") {
56 sh = fanduct_w+2*fanduct_shell; sv = fanduct_h+2*fanduct_shell; 56 sh = fanduct_w+2*fanduct_shell; sv = fanduct_h+2*fanduct_shell;
57 smax = max(sh,sv); 57 smax = max(sh,sv);
58 rotate_extrude($fn=smooth_f) 58 rotate_extrude($fn=smooth_f)
59 if(ductshape=="round") 59 if(ductshape=="round")
60 translate([sh/2+fanduct_ir,sv/2]) 60 translate([sh/2+fanduct_ir,sv/2])
61 scale([sh/smax,sv/smax]) 61 scale([sh/smax,sv/smax])
62 circle(d=smax,$fn=4*smax); 62 circle(d=smax,$fn=4*smax);
63 else if(ductshape=="square") 63 else if(ductshape=="square")
64 translate([fanduct_ir,0]) 64 translate([fanduct_ir,0])
65 square([sh,sv]); 65 square([sh,sv]);
66 }else if(what=="out") { 66 }else if(what=="out") {
67 sh = fanduct_w; sv = fanduct_h; 67 sh = fanduct_w; sv = fanduct_h;
68 smax = max(sh,sv); 68 smax = max(sh,sv);
69 rotate_extrude($fn=smooth_f) 69 rotate_extrude($fn=smooth_f)
70 if(ductshape=="round") 70 if(ductshape=="round")
71 translate([sh/2+fanduct_shell+fanduct_ir,sv/2+fanduct_shell]) 71 translate([sh/2+fanduct_shell+fanduct_ir,sv/2+fanduct_shell])
72 scale([sh/smax,sv/smax]) 72 scale([sh/smax,sv/smax])
73 circle(d=smax,$fn=4*smax); 73 circle(d=smax,$fn=4*smax);
74 else if(ductshape=="square") 74 else if(ductshape=="square")
75 translate([fanduct_ir+fanduct_shell,fanduct_shell]) 75 translate([fanduct_ir+fanduct_shell,fanduct_shell])
76 union() { 76 union() {
77 square([sh,sv/2]); 77 square([sh,sv/2]);
78 translate([sh/2,sv/2]) 78 translate([sh/2,sv/2])
79 scale([sh/smax,sv/smax]) 79 scale([sh/smax,sv/smax])
80 circle(d=smax,$fn=36); 80 circle(d=smax,$fn=36);
81 } 81 }
82 } 82 }
83 } 83 }
84 module dual() { 84 module dual() {
85 module hulls(spots=dual_spots) { 85 module hulls(spots=dual_spots) {
86 for(my=[0,1]) mirror([0,my,0]) for(pn=[0:1:len(spots)-2]) hull() { 86 for(my=[0,1]) mirror([0,my,0]) for(pn=[0:1:len(spots)-2]) hull() {
87 for(p=[spots[pn],spots[pn+1]]) translate(p) children(); 87 for(p=[spots[pn],spots[pn+1]]) translate(p) children();
88 } 88 }
89 } 89 }
90 if(what=="in") { 90 if(what=="in") {
91 hulls() cylinder(d=fanduct_w+2*fanduct_shell,h=fanduct_h+2*fanduct_shell); 91 hulls() cylinder(d=fanduct_w+2*fanduct_shell,h=fanduct_h+2*fanduct_shell);
92 }else if(what=="out") { 92 }else if(what=="out") {
93 sh = fanduct_w; sv = fanduct_h; 93 sh = fanduct_w; sv = fanduct_h;
94 smax = max(sh,sv); 94 smax = max(sh,sv);
95 translate([0,0,fanduct_shell]) hulls() { 95 translate([0,0,fanduct_shell]) hulls() {
96 cylinder(d=fanduct_w,h=fanduct_h/2); 96 cylinder(d=fanduct_w,h=fanduct_h/2);
97 translate([0,0,fanduct_h/2]) 97 translate([0,0,fanduct_h/2])
98 scale([sh/smax,sh/smax,sv/smax]) 98 scale([sh/smax,sh/smax,sv/smax])
99 intersection() { 99 intersection() {
100 sphere(d=smax,$fn=36); 100 sphere(d=smax,$fn=36);
101 translate([0,0,-1]) 101 translate([0,0,-1])
102 cylinder(d=smax+2,h=smax+2,$fn=36); 102 cylinder(d=smax+2,h=smax+2,$fn=36);
103 } 103 }
104 } 104 }
105 } 105 }
106 } 106 }
107 module dual_simple() {
108 for(my=[0,1]) mirror([0,my,0])
109 if(what=="in") {
110 sh = fanduct_w+2*fanduct_shell; sv = fanduct_h+2*fanduct_shell;
111 translate([0,nozzles_apart/2,0])
112 intersection() {
113 rotate_extrude($fn=smooth_f)
114 translate([fanduct_ir,0]) square([sh,sv]);
115 translate([-fanduct_ir-sh-1,0,-1])
116 cube(size=[fanduct_ir+sh+2,fanduct_ir+sh+2,sv+2]);
117 }
118 translate([-fanduct_ir-sh,-epsilon,0])
119 cube(size=[sh,nozzles_apart/2+2*epsilon,sv]);
120 translate([0,sh/2+fanduct_ir+nozzles_apart/2,0]) cylinder(d=sh,h=sv,$fn=36);
121 }else if(what=="out") {
122 sh = fanduct_w; sv = fanduct_h;
123 translate([0,nozzles_apart/2,fanduct_shell])
124 intersection() {
125 rotate_extrude($fn=smooth_f)
126 translate([fanduct_ir+fanduct_shell,0]) square([sh,sv]);
127 translate([-fanduct_ir-2*fanduct_shell-sh-1,-1,0])
128 cube(size=[fanduct_ir+2*fanduct_shell+sh+2,fanduct_ir+2*fanduct_shell+sh+2,sv]);
129 }
130 translate([-fanduct_ir-fanduct_shell-sh,-epsilon,fanduct_shell])
131 cube(size=[sh,nozzles_apart/2+2*epsilon,sv]);
132 translate([0,sh/2+fanduct_shell+fanduct_ir+nozzles_apart/2,fanduct_shell])
133 cylinder(d=sh,h=sv,$fn=36);
134 }
135 }
107 136
108 if(dual) dual(); 137 if(dual) {
109 else single(); 138 if(type=="simple")
139 dual_simple();
140 else dual();
141 }else single();
110 } 142 }
111 143
112 // ***bumps for easier position adjustments in line with hotend 144 // ***bumps for easier position adjustments in line with hotend
113 module marks(what) { 145 module marks(what) {
114 if(what=="in") { 146 if(what=="in") {
115 for(y=[-1,1]) translate([0,dual?y*nozzles_apart/2:0,0]) 147 for(y=[-1,1]) translate([0,dual?y*nozzles_apart/2:0,0])
116 hull() for(z=[0,-fanduct_shell-fanduct_h/2]) 148 hull() for(z=[0,-fanduct_shell-fanduct_h/2])
117 translate([0,y*(fanduct_ir+fanduct_shell+fanduct_w/2),fanduct_shell*2+fanduct_h+z]) 149 translate([0,y*(fanduct_ir+fanduct_shell+fanduct_w/2),fanduct_shell*2+fanduct_h+z])
118 rotate([90,0,0]) { 150 rotate([90,0,0]) {
119 cylinder(r=fanduct_shell,h=fanduct_w,center=true,$fn=30); 151 cylinder(r=fanduct_shell,h=fanduct_w,center=true,$fn=30);
120 for(z=[-1,1]) translate([0,0,z*fanduct_w/2]) 152 for(z=[-1,1]) translate([0,0,z*fanduct_w/2])
121 sphere(r=fanduct_shell,$fn=30); 153 sphere(r=fanduct_shell,$fn=30);
122 } 154 }
123 } 155 }
124 } 156 }
125 157
126 // ***output 158 // ***output
127 module output(what,type=type) { 159 module output(what,type=type) {
128 module guideline(xyxy) { 160 module guideline(xyxy) {
129 module pin(xy) { 161 module pin(xy) {
130 translate([xy[0],xy[1],0]) 162 translate([xy[0],xy[1],0])
131 cylinder(d=2*extrusion_width,h=2*fanduct_shell+inlet_h,$fn=6); 163 cylinder(d=2*extrusion_width,h=2*fanduct_shell+inlet_h,$fn=6);
132 } 164 }
133 xyxyxy=concat(xyxy,[[0,dual?nozzles_apart/2:0]]); 165 xyxyxy=concat(xyxy,[[0,dual?nozzles_apart/2:0]]);
134 for(i=[0:1:len(xyxyxy)-2]) 166 for(i=[0:1:len(xyxyxy)-2])
135 hull() for(j=[i,i+1]) pin(xyxyxy[j]); 167 hull() for(j=[i,i+1]) pin(xyxyxy[j]);
136 } 168 }
137 169
138 module circus(what) { 170 module circus(what) {
139 if(what=="in") { 171 if(what=="in") {
140 difference() { 172 difference() {
141 rotate_extrude($fn=smooth_f) 173 rotate_extrude($fn=smooth_f)
142 polygon([ 174 polygon([
143 [0,-fanduct_elevation+fanduct_blowtarget+epsilon], 175 [0,-fanduct_elevation+fanduct_blowtarget+epsilon],
144 [fanduct_ir+fanduct_shell,fanduct_shell+fanduct_h/2], 176 [fanduct_ir+fanduct_shell,fanduct_shell+fanduct_h/2],
145 [fanduct_ir+fanduct_shell+fanduct_w/2,0], 177 [fanduct_ir+fanduct_shell+fanduct_w/2,0],
146 [0,-fanduct_elevation+fanduct_blowtarget-epsilon]]); 178 [0,-fanduct_elevation+fanduct_blowtarget-epsilon]]);
147 translate([0,0,-1]) 179 translate([0,0,-1])
148 cylinder(r=hotend_clearance,h=fanduct_h+2*fanduct_shell+2,$fn=smooth_f); 180 cylinder(r=hotend_clearance,h=fanduct_h+2*fanduct_shell+2,$fn=smooth_f);
149 mirror([0,0,1]) 181 mirror([0,0,1])
150 translate([0,0,-epsilon]) 182 translate([0,0,-epsilon])
151 cylinder(r=fanduct_ir+2*fanduct_shell+fanduct_w+1,h=fanduct_elevation+.1+2); 183 cylinder(r=fanduct_ir+2*fanduct_shell+fanduct_w+1,h=fanduct_elevation+.1+2);
152 } 184 }
153 }else if(what=="out") { 185 }else if(what=="out") {
154 rotate_extrude($fn=smooth_f) 186 rotate_extrude($fn=smooth_f)
155 polygon([ 187 polygon([
156 [0,-fanduct_elevation+fanduct_blowtarget+epsilon], 188 [0,-fanduct_elevation+fanduct_blowtarget+epsilon],
157 [fanduct_ir+fanduct_shell+1,fanduct_h/2], 189 [fanduct_ir+fanduct_shell+1,fanduct_h/2],
158 [fanduct_ir+fanduct_w/2+fanduct_shell+1,fanduct_shell], 190 [fanduct_ir+fanduct_w/2+fanduct_shell+1,fanduct_shell],
159 [0,-fanduct_elevation+fanduct_blowtarget-epsilon]]); 191 [0,-fanduct_elevation+fanduct_blowtarget-epsilon]]);
160 }else if(what=="airguides") { 192 }else if(what=="airguides") {
161 inr = fanduct_ir+fanduct_shell; our = inr+fanduct_w; 193 inr = fanduct_ir+fanduct_shell; our = inr+fanduct_w;
162 union() { 194 union() {
163 for(my=[0,1]) mirror([0,my,0]) { 195 for(my=[0,1]) mirror([0,my,0]) {
164 guideline([ 196 guideline([
165 [-our,inlet_w/6], 197 [-our,inlet_w/6],
166 [-inr*sin(60),inr*cos(60)] 198 [-inr*sin(60),inr*cos(60)]
167 ]); 199 ]);
168 a0=30; as=15; a1=180; 200 a0=30; as=15; a1=180;
169 for(a=[a0+as:as:a1]) { 201 for(a=[a0+as:as:a1]) {
170 f = as/(a1-a+as); 202 f = as/(a1-a+as);
171 rotate([0,0,a]) guideline([[-inr-fanduct_w*f,0]]); 203 rotate([0,0,a]) guideline([[-inr-fanduct_w*f,0]]);
172 } 204 }
173 guideline([ 205 guideline([
174 [-our+fanduct_w*cos(30)*3/4,fanduct_w*sin(30)*3/4], 206 [-our+fanduct_w*cos(30)*3/4,fanduct_w*sin(30)*3/4],
175 [-inr*cos(10),inr*sin(10)] 207 [-inr*cos(10),inr*sin(10)]
176 ]); 208 ]);
177 } 209 }
178 }/*union*/ 210 }/*union*/
179 }/*airguides*/ 211 }/*airguides*/
180 } 212 }
181 213
182 module jets(what) { 214 module jets(what) {
183 od = fanduct_h*2/3+fanduct_shell; 215 od = fanduct_h*2/3+fanduct_shell;
184 md = fanduct_ir+fanduct_shell+fanduct_w/2; 216 md = fanduct_ir+fanduct_shell+fanduct_w/2;
185 jww = 2*md*sin(jet_angle/2); 217 jww = 2*md*sin(jet_angle/2);
186 difference() { 218 difference() {
187 for(a=[0:120:359]) rotate([0,0,a]) { 219 for(a=[0:120:359]) rotate([0,0,a]) {
188 if(what=="in") { 220 if(what=="in") {
189 hull() { 221 hull() {
190 intersection() { 222 intersection() {
191 translate([md-fanduct_w/2,-jww/2,0]) 223 translate([md-fanduct_w/2,-jww/2,0])
192 cube(size=[fanduct_shell+fanduct_w/2,jww,od]); 224 cube(size=[fanduct_shell+fanduct_w/2,jww,od]);
193 duct(what=what); 225 duct(what=what);
194 } 226 }
195 translate([0,0,-fanduct_elevation]) sphere(r=.5); 227 translate([0,0,-fanduct_elevation]) sphere(r=.5);
196 } 228 }
197 }else if(what=="out") { 229 }else if(what=="out") {
198 hull() { 230 hull() {
199 intersection() { 231 intersection() {
200 translate([md-fanduct_w/2,-jww/2+fanduct_shell,fanduct_shell]) 232 translate([md-fanduct_w/2,-jww/2+fanduct_shell,fanduct_shell])
201 cube(size=[fanduct_w/2,jww-2*fanduct_shell,od-2*fanduct_shell]); 233 cube(size=[fanduct_w/2,jww-2*fanduct_shell,od-2*fanduct_shell]);
202 duct(what=what); 234 duct(what=what);
203 } 235 }
204 translate([0,0,-fanduct_elevation]) sphere(r=.2); 236 translate([0,0,-fanduct_elevation]) sphere(r=.2);
205 } 237 }
206 } 238 }
207 } 239 }
208 if(what=="in") { 240 if(what=="in") {
209 translate([0,0,-fanduct_elevation-2+epsilon]) 241 translate([0,0,-fanduct_elevation-2+epsilon])
210 cylinder(r=fanduct_ir+fanduct_shell*2+fanduct_w+1,h=fanduct_elevation+2); 242 cylinder(r=fanduct_ir+fanduct_shell*2+fanduct_w+1,h=fanduct_elevation+2);
211 translate([0,0,-hotend_clearance]) 243 translate([0,0,-hotend_clearance])
212 rotate([0,0,30]) 244 rotate([0,0,30])
213 cylinder(r1=hotend_clearance*2,r2=0,h=hotend_clearance*2,$fn=6); 245 cylinder(r1=hotend_clearance*2,r2=0,h=hotend_clearance*2,$fn=6);
214 } 246 }
215 } 247 }
216 } 248 }
217 249
218 module dual(what=what) { 250 module dual(what=what) {
219 module hulls(spots=dual_spots) { 251 module hulls(spots=dual_spots) {
220 for(my=[0,1]) mirror([0,my,0]) for(pn=[0:1:len(spots)-2]) hull() { 252 for(my=[0,1]) mirror([0,my,0]) for(pn=[0:1:len(spots)-2]) hull() {
221 for(p=[spots[pn],spots[pn+1]]) translate(p) children(0); 253 for(p=[spots[pn],spots[pn+1]]) translate(p) children(0);
222 children([1:$children-1]); 254 children([1:$children-1]);
223 } 255 }
224 } 256 }
225 if(what=="in") { 257 if(what=="in") {
226 cfn= 4; // clearance cutout $fn 258 cfn= 4; // clearance cutout $fn
227 difference() { 259 difference() {
228 hulls() { 260 hulls() {
229 cylinder(d=fanduct_w+2*fanduct_shell,h=2*fanduct_shell+fanduct_h/2); 261 cylinder(d=fanduct_w+2*fanduct_shell,h=2*fanduct_shell+fanduct_h/2);
230 translate([0,-nozzles_apart/2,-fanduct_elevation-fanduct_blowtarget]) sphere(d=.1); 262 translate([0,-nozzles_apart/2,-fanduct_elevation-fanduct_blowtarget]) sphere(d=.1);
231 } 263 }
232 translate([0,0,epsilon]) hull() for(my=[0:1]) mirror([0,my,0]) for(s=dual_spots) translate(s) 264 translate([0,0,epsilon]) hull() for(my=[0:1]) mirror([0,my,0]) for(s=dual_spots) translate(s)
233 mirror([0,0,1]) cylinder(d=fanduct_w+2*fanduct_shell+2,h=fanduct_elevation-fanduct_blowtarget+1); 265 mirror([0,0,1]) cylinder(d=fanduct_w+2*fanduct_shell+2,h=fanduct_elevation-fanduct_blowtarget+1);
234 for(s=[-1,1]) translate([0,s*nozzles_apart/2,-1]) 266 for(s=[-1,1]) translate([0,s*nozzles_apart/2,-1])
235 rotate([0,0,180/cfn]) cylinder(r=hotend_clearance/cos(180/cfn),h=fanduct_h+2*fanduct_shell+2,$fn=cfn); 267 rotate([0,0,180/cfn]) cylinder(r=hotend_clearance/cos(180/cfn),h=fanduct_h+2*fanduct_shell+2,$fn=cfn);
236 } 268 }
237 }else if(what=="out") { 269 }else if(what=="out") {
238 hulls() { 270 hulls() {
239 translate([0,0,fanduct_shell]) cylinder(d=fanduct_w,h=fanduct_h/2-fanduct_shell/2); 271 translate([0,0,fanduct_shell]) cylinder(d=fanduct_w,h=fanduct_h/2-fanduct_shell/2);
240 translate([0,-nozzles_apart/2,-fanduct_elevation+fanduct_blowtarget]) sphere(d=.1); 272 translate([0,-nozzles_apart/2,-fanduct_elevation+fanduct_blowtarget]) sphere(d=.1);
241 } 273 }
242 }else if(what=="airguides") { 274 }else if(what=="airguides") {
243 far = fanduct_ir+fanduct_shell+fanduct_w; 275 far = fanduct_ir+fanduct_shell+fanduct_w;
244 near = fanduct_ir; 276 near = fanduct_ir;
245 union() { 277 union() {
246 for(my=[0,1]) mirror([0,my,0]) { 278 for(my=[0,1]) mirror([0,my,0]) {
247 guideline([ [-far ,0], [0, nozzles_apart/8] ]); 279 guideline([ [-far ,0], [0, nozzles_apart/8] ]);
248 guideline([ [-far ,inlet_w/2/4 ], 280 guideline([ [-far ,inlet_w/2/4 ],
249 [-near ,to_midduct/2] ]); 281 [-near ,to_midduct/2] ]);
250 guideline([ [-near-fanduct_w/3, to_midduct/2 ], 282 guideline([ [-near-fanduct_w/3, to_midduct/2 ],
251 [-near ,nozzles_apart/2+near ] ]); 283 [-near ,nozzles_apart/2+near ] ]);
252 guideline([ [0 ,nozzles_apart/2+near+fanduct_w*space_behind_nozzle/to_midduct] ]); 284 guideline([ [0 ,nozzles_apart/2+near+fanduct_w*space_behind_nozzle/to_midduct] ]);
253 } 285 }
254 } 286 }
255 } 287 }
256 } 288 }
257 289
258 if(dual) dual(what); 290 module dual_simple(what=what) {
259 else if(type=="circular") circus(what); 291 for(my=[0:1]) mirror([0,my,0]) if(what=="in") {
292 difference() {
293 hull() {
294 translate([0,nozzles_apart/2+fanduct_ir+fanduct_shell+fanduct_w/2,0])
295 cylinder(d=fanduct_w+2*fanduct_shell,h=fanduct_h*2/3+2*fanduct_shell);
296 translate([0,nozzles_apart/2,-fanduct_elevation+fanduct_blowtarget])
297 rotate([0,90,0]) cylinder(r=.5,h=fanduct_w*2,center=true);
298 }
299 rr = 2*(fanduct_ir+fanduct_shell*2+fanduct_w+2);
300 translate([-rr/2,0,0]) mirror([0,0,1]) cube(size=[rr,rr,rr]);
301 }
302 }else if(what=="out") {
303 hull() {
304 translate([0,nozzles_apart/2+fanduct_ir+fanduct_shell+fanduct_w/2,fanduct_shell])
305 cylinder(d=fanduct_w,h=fanduct_h*2/3);
306 translate([0,nozzles_apart/2,-fanduct_elevation+fanduct_blowtarget])
307 rotate([0,90,0]) cylinder(d=.5,h=fanduct_w*2,center=true);
308 }
309 }
310 }
311
312 if(dual) {
313 if(type=="simple") dual_simple(what);
314 else dual(what);
315 }else if(type=="circular") circus(what);
260 else if(type=="3jets") jets(what); 316 else if(type=="3jets") jets(what);
261 } 317 }
262 318
263 // ***air intake 319 // ***air intake
264 module intake(what) { 320 module intake(what) {
265 module placeit() { 321 module placeit() {
266 translate([-fanduct_ir-2*fanduct_shell-fanduct_w-inlet_away,0,fanduct_shell]) 322 translate([-fanduct_ir-2*fanduct_shell-fanduct_w-inlet_away,0,fanduct_shell])
267 rotate([0,-90,0]) 323 rotate([0,-90,0])
268 children(); 324 children();
269 } 325 }
270 if(what=="in") { 326 if(what=="in") {
271 placeit() translate([0,-inlet_w/2,0]) { 327 placeit() translate([0,-inlet_w/2,0]) {
272 difference() { 328 difference() {
273 cube(size=[inlet_h,inlet_w,inlet_long_l+fanduct_shell]); translate([inlet_h+fanduct_shell,0,inlet_long_l+fanduct_shell]) 329 cube(size=[inlet_h,inlet_w,inlet_long_l+fanduct_shell]); translate([inlet_h+fanduct_shell,0,inlet_long_l+fanduct_shell])
274 rotate([-90,0,0]) 330 rotate([-90,0,0])
275 translate([0,0,-1]) 331 translate([0,0,-1])
276 cylinder(r=inlet_h,h=inlet_w+2*fanduct_shell+2,$fn=inlet_h*4); 332 cylinder(r=inlet_h,h=inlet_w+2*fanduct_shell+2,$fn=inlet_h*4);
277 } 333 }
278 // supports 334 // supports
279 for(i=[-1,0,1]) 335 for(i=[-1,0,1])
280 translate([-fanduct_shell, 336 translate([-fanduct_shell,
281 (i+1)*(inlet_w-extrusion_width)/2, 337 (i+1)*(inlet_w-extrusion_width)/2,
282 -inlet_away-fanduct_w/2]) 338 -inlet_away-fanduct_w/2])
283 cube(size=[fanduct_shell+1, 339 cube(size=[fanduct_shell+1,
284 extrusion_width, 340 extrusion_width,
285 inlet_long_l+fanduct_shell+inlet_away+fanduct_w/2]); 341 inlet_long_l+fanduct_shell+inlet_away+fanduct_w/2]);
286 } 342 }
287 hull() { 343 hull() {
288 placeit() translate([-fanduct_shell,-inlet_w/2-fanduct_shell,0]) 344 placeit() translate([-fanduct_shell,-inlet_w/2-fanduct_shell,0])
289 cube(size=[inlet_h+2*fanduct_shell,inlet_w+2*fanduct_shell,fanduct_shell]); 345 cube(size=[inlet_h+2*fanduct_shell,inlet_w+2*fanduct_shell,fanduct_shell]);
290 translate([-fanduct_ir-fanduct_shell-fanduct_w/2,0,0]) 346 translate([-fanduct_ir-fanduct_shell-fanduct_w/2,0,0])
291 translate([0,-inlet_w/2-fanduct_shell/2,0]) 347 translate([0,-inlet_w/2-fanduct_shell/2,0])
292 cube(size=[1,inlet_w+fanduct_shell,fanduct_shell*2+fanduct_h]); 348 cube(size=[1,inlet_w+fanduct_shell,fanduct_shell*2+fanduct_h]);
293 } 349 }
294 }else if(what=="out") { 350 }else if(what=="out") {
295 placeit() translate([fanduct_shell,-inlet_w/2+fanduct_shell,0]) 351 placeit() translate([fanduct_shell,-inlet_w/2+fanduct_shell,0])
296 cube(size=[inlet_h-2*fanduct_shell,inlet_w-2*fanduct_shell,inlet_long_l+fanduct_shell+1]); 352 cube(size=[inlet_h-2*fanduct_shell,inlet_w-2*fanduct_shell,inlet_long_l+fanduct_shell+1]);
297 hull() { 353 hull() {
298 placeit() translate([fanduct_shell,-inlet_w/2+fanduct_shell,0]) 354 placeit() translate([fanduct_shell,-inlet_w/2+fanduct_shell,0])
299 cube(size=[inlet_h-2*fanduct_shell,inlet_w-2*fanduct_shell,fanduct_shell]); 355 cube(size=[inlet_h-2*fanduct_shell,inlet_w-2*fanduct_shell,fanduct_shell]);
300 translate([-fanduct_ir-fanduct_shell-fanduct_w/2,0,fanduct_shell]) 356 translate([-fanduct_ir-fanduct_shell-fanduct_w/2,0,fanduct_shell])
301 translate([0,-inlet_w/2+fanduct_shell,0]) 357 translate([0,-inlet_w/2+fanduct_shell,0])
302 cube(size=[1,inlet_w-2*fanduct_shell,fanduct_h]); 358 cube(size=[1,inlet_w-2*fanduct_shell,fanduct_h]);
303 } 359 }
304 } 360 }
305 } 361 }
306 362
307 // ***DUCT TAILS!!! WOO-OO! (every day they're out there making duct tails…) 363 // ***DUCT TAILS!!! WOO-OO! (every day they're out there making duct tails…)
308 module tails(what) { 364 module tails(what) {
309 if(dual) { 365 if(dual) {
310 // XXX: not sure if it will ever be 366 // XXX: not sure if it will ever be
311 }else{ 367 }else{
312 if(what=="in") { 368 if(what=="in") {
313 for(mx=[0,1]) mirror([mx,0,0]) 369 for(mx=[0,1]) mirror([mx,0,0])
314 translate([fanduct_ir+fanduct_shell+fanduct_w/2,0,fanduct_shell+fanduct_h/2]) 370 translate([fanduct_ir+fanduct_shell+fanduct_w/2,0,fanduct_shell+fanduct_h/2])
315 rotate([90,0,90]) 371 rotate([90,0,90])
316 translate([0,0,-snapper_d/2]) 372 translate([0,0,-snapper_d/2])
317 snapper(d=snapper_d,o=snapper_overlap,side=0,l=fanduct_h*3/2+fanduct_shell); 373 snapper(d=snapper_d,o=snapper_overlap,side=0,l=fanduct_h*3/2+fanduct_shell);
318 } 374 }
319 } 375 }
320 } 376 }
321 377
322 module parts(what) { 378 module parts(what) {
323 union() { 379 union() {
324 duct(what); 380 duct(what);
325 marks(what); 381 marks(what);
326 output(what); 382 output(what);
327 intake(what); 383 intake(what);
328 tails(what); 384 tails(what);
329 } 385 }
330 } 386 }
331 387
332 difference() { 388 difference() {
333 parts("in"); 389 parts("in");
334 parts("out"); 390 parts("out");
335 } 391 }
336 intersection() { 392 intersection() {
337 union() { 393 union() {
338 output("airguides"); 394 output("airguides");
339 sphere(d=epsilon); 395 sphere(d=epsilon);
340 } 396 }
341 union() { 397 union() {
342 duct("in"); output("in"); intake("in"); 398 duct("in"); output("in"); intake("in");
343 } 399 }
344 } 400 }
345} 401}
346 402
347view="*"; // hcut|vcut|* 403view="*"; // hcut|vcut|*
348 404
349hinfinity=4*(fanduct_ir+fanduct_shell*2+fanduct_w+inlet_away); 405hinfinity=4*(fanduct_ir+fanduct_shell*2+fanduct_w+inlet_away);
350vinfinity=2*(fanduct_shell*2+fanduct_h+inlet_h); 406vinfinity=2*(fanduct_shell*2+fanduct_h+inlet_h);
351if(view=="hcut") { 407if(view=="hcut") {
352 difference() { 408 difference() {
353 fanduct(); 409 fanduct();
354 translate([-hinfinity/2,-hinfinity/2,fanduct_shell+fanduct_h/2]) 410 translate([-hinfinity/2,-hinfinity/2,fanduct_shell+fanduct_h/2])
355 cube(size=[hinfinity,hinfinity,vinfinity]); 411 cube(size=[hinfinity,hinfinity,vinfinity]);
356 } 412 }
357}else if(view=="vcut") { 413}else if(view=="vcut") {
358 difference() { 414 difference() {
359 fanduct(); 415 fanduct();
360 translate([-hinfinity/2,0,-vinfinity/2]) 416 translate([-hinfinity/2,0,-vinfinity/2])
361 cube(size=[hinfinity,hinfinity,vinfinity]); 417 cube(size=[hinfinity,hinfinity,vinfinity]);
362 } 418 }
363}else fanduct(); 419}else fanduct();
364/* vim:set sw=1 ai: */ 420/* vim:set sw=1 ai: */