author | Michael Krelin <hacker@klever.net> | 2016-07-21 16:10:58 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2016-07-21 16:10:58 (UTC) |
commit | 9cceb044d036c37c8c8703926c9c84d1d88cc2e0 (patch) (unidiff) | |
tree | 99df49970a2c5b630e8f35db65ce437ae32cca93 | |
parent | c37fd834984997726d5f30b353a19a3eed3cfbd7 (diff) | |
download | fanductory-9cceb044d036c37c8c8703926c9c84d1d88cc2e0.zip fanductory-9cceb044d036c37c8c8703926c9c84d1d88cc2e0.tar.gz fanductory-9cceb044d036c37c8c8703926c9c84d1d88cc2e0.tar.bz2 |
ductshape generator
-rw-r--r-- | fanduct.scad | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/fanduct.scad b/fanduct.scad index a17b261..ba63717 100644 --- a/fanduct.scad +++ b/fanduct.scad | |||
@@ -47,41 +47,43 @@ to_midduct = fanduct_ir+fanduct_shell+fanduct_w/2; | |||
47 | dual_spots = [ [+space_behind_nozzle, -(to_midduct+nozzles_apart/2)], | 47 | dual_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 | ||
51 | module fanduct(type=type,ductshape=ductshape,dual=dual) { | 51 | module fanduct(type=type,ductshape=ductshape,dual=dual) { |
52 | // ***duct is all around! | 52 | // ***duct is all around! |
53 | |||
53 | module duct(what) { | 54 | module duct(what) { |
55 | module ductshape(what,sh,sv,r) { | ||
56 | smax = max(sh,sv); | ||
57 | translate([what=="in"?0:fanduct_shell,what=="in"?0:fanduct_shell]) | ||
58 | if(ductshape=="round") { | ||
59 | translate([sh/2+r,sv/2]) | ||
60 | scale([sh/smax,sv/smax]) | ||
61 | circle(d=smax,$fn=4*smax); | ||
62 | }else if(ductshape=="square") { | ||
63 | translate([r,0]) | ||
64 | if(what=="in") | ||
65 | square([sh,sv]); | ||
66 | else if(what=="out") union() { | ||
67 | square([sh,sv/2]); | ||
68 | translate([sh/2,sv/2]) | ||
69 | scale([sh/smax,sv/smax]) | ||
70 | circle(d=smax,$fn=4*smax); | ||
71 | } | ||
72 | } | ||
73 | } | ||
54 | module single() { | 74 | module single() { |
55 | if(what=="in") { | 75 | if(what=="in") { |
56 | 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; |
57 | smax = max(sh,sv); | ||
58 | rotate_extrude($fn=smooth_f) | 77 | rotate_extrude($fn=smooth_f) |
59 | if(ductshape=="round") | 78 | ductshape(what=what,sh=sh,sv=sv,r=fanduct_ir); |
60 | translate([sh/2+fanduct_ir,sv/2]) | ||
61 | scale([sh/smax,sv/smax]) | ||
62 | circle(d=smax,$fn=4*smax); | ||
63 | else if(ductshape=="square") | ||
64 | translate([fanduct_ir,0]) | ||
65 | square([sh,sv]); | ||
66 | }else if(what=="out") { | 79 | }else if(what=="out") { |
67 | sh = fanduct_w; sv = fanduct_h; | 80 | sh = fanduct_w; sv = fanduct_h; |
68 | smax = max(sh,sv); | 81 | smax = max(sh,sv); |
69 | rotate_extrude($fn=smooth_f) | 82 | rotate_extrude($fn=smooth_f) |
70 | if(ductshape=="round") | 83 | ductshape(what=what,sh=sh,sv=sv,r=fanduct_ir); |
71 | translate([sh/2+fanduct_shell+fanduct_ir,sv/2+fanduct_shell]) | ||
72 | scale([sh/smax,sv/smax]) | ||
73 | circle(d=smax,$fn=4*smax); | ||
74 | else if(ductshape=="square") | ||
75 | translate([fanduct_ir+fanduct_shell,fanduct_shell]) | ||
76 | union() { | ||
77 | square([sh,sv/2]); | ||
78 | translate([sh/2,sv/2]) | ||
79 | scale([sh/smax,sv/smax]) | ||
80 | circle(d=smax,$fn=36); | ||
81 | } | ||
82 | } | 84 | } |
83 | } | 85 | } |
84 | module dual() { | 86 | module dual() { |
85 | module hulls(spots=dual_spots) { | 87 | module hulls(spots=dual_spots) { |
86 | 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() { |
87 | for(p=[spots[pn],spots[pn+1]]) translate(p) children(); | 89 | for(p=[spots[pn],spots[pn+1]]) translate(p) children(); |