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) (side-by-side diff) | |
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 @@ -50,35 +50,37 @@ dual_spots = [ [+space_behind_nozzle, -(to_midduct+nozzles_apart/2)], module fanduct(type=type,ductshape=ductshape,dual=dual) { // *** duct is all around! + module duct(what) { + module ductshape(what,sh,sv,r) { + smax = max(sh,sv); + translate([what=="in"?0:fanduct_shell,what=="in"?0:fanduct_shell]) + if(ductshape=="round") { + translate([sh/2+r,sv/2]) + scale([sh/smax,sv/smax]) + circle(d=smax,$fn=4*smax); + }else if(ductshape=="square") { + translate([r,0]) + if(what=="in") + square([sh,sv]); + else if(what=="out") union() { + square([sh,sv/2]); + translate([sh/2,sv/2]) + scale([sh/smax,sv/smax]) + circle(d=smax,$fn=4*smax); + } + } + } module single() { if(what=="in") { sh = fanduct_w+2*fanduct_shell; sv = fanduct_h+2*fanduct_shell; - smax = max(sh,sv); rotate_extrude($fn=smooth_f) - if(ductshape=="round") - translate([sh/2+fanduct_ir,sv/2]) - scale([sh/smax,sv/smax]) - circle(d=smax,$fn=4*smax); - else if(ductshape=="square") - translate([fanduct_ir,0]) - square([sh,sv]); + ductshape(what=what,sh=sh,sv=sv,r=fanduct_ir); }else if(what=="out") { sh = fanduct_w; sv = fanduct_h; smax = max(sh,sv); rotate_extrude($fn=smooth_f) - if(ductshape=="round") - translate([sh/2+fanduct_shell+fanduct_ir,sv/2+fanduct_shell]) - scale([sh/smax,sv/smax]) - circle(d=smax,$fn=4*smax); - else if(ductshape=="square") - translate([fanduct_ir+fanduct_shell,fanduct_shell]) - union() { - square([sh,sv/2]); - translate([sh/2,sv/2]) - scale([sh/smax,sv/smax]) - circle(d=smax,$fn=36); - } + ductshape(what=what,sh=sh,sv=sv,r=fanduct_ir); } } module dual() { |