include ; wall = 2; grid = 1; gridspace = 3; finegrid = 1; finegridspace = 1; finegridheight = 1; offset = -.3; // Set this to your layer height so we have support. fan=40; lidh=5; porthole = 4; portwidth = 8; module fanmount(){ union(){ translate([fan/2,-fan/2,0])rotate([0,180,0])fan_mount(fan,5); difference(){ translate([fan/2,-fan/2,wall])rotate([0,180,0])cube([40,40,wall]); maincyl(); } } } module maincyl(){ translate([0,0,-1])cylinder(r1=fan/2,r2=fan,h=fan/2); } module maincut(){ translate([0,0,-1])cylinder(r1=fan/2-wall,r2=fan-wall,h=fan/2); } module grategrid(){ for(i=[-fan:2*gridspace:fan]){ translate([i,-fan*2,-1])cube([grid,4*fan,fan]); } } module grateshape(){ //cylinder(h=wall,r=fan/2+fan/4); maincyl(); //translate([0,0,-1])cylinder(r1=fan/2-wall/2,r2=fan-wall/2,h=fan/2); //maincut(); } module gratea(){ difference(){ intersection(){ grateshape(); grategrid(); } translate([-fan,-fan,-wall+offset])cube([2*fan,2*fan,fan/4]); difference(){ translate([-fan,-fan,fan/4])cube([2*fan,2*fan,fan]); //translate([-wall/2,-2*fan,0])cube([wall,4*fan,2*fan]); //translate([-2*fan,-wall/2,0])cube([4*fan,wall,2*fan]); } } } module grateb(){ difference(){ intersection(){ rotate([0,0,90])grategrid(); grateshape(); } translate([-fan,-fan,-wall])cube([2*fan,2*fan,fan/4]); difference(){ translate([-fan,-fan,fan/4-offset])cube([2*fan,2*fan,fan]); translate([-wall/2,-2*fan,0])cube([wall,4*fan,2*fan]); //translate([-2*fan,-wall/2,0])cube([4*fan,wall,2*fan]); } } } module grate(){ gratea(); grateb(); } module finegrategrid(){ for(i=[-fan:finegrid+finegridspace:fan]){ translate([i,-fan*2,-1])cube([finegrid,4*fan,fan]); } } module finegrateshape(){ //cylinder(h=wall,r=fan/2+fan/4); maincyl(); } module finegratea(){ difference(){ intersection(){ finegrateshape(); finegrategrid(); } translate([-fan,-fan,-wall-finegridheight+offset])cube([2*fan,2*fan,fan/4]); // bottom of big grid bottom translate([-fan,-fan,fan/4-wall])cube([2*fan,2*fan,fan]); // bottom of big grid top } } module finegrateb(){ difference(){ intersection(){ rotate([0,0,90])finegrategrid(); finegrateshape(); } translate([-fan,-fan,-wall-finegridheight+offset])cube([2*fan,2*fan,fan/4]); // bottom of big grid bottom translate([-fan,-fan,fan/4-wall-offset])cube([2*fan,2*fan,fan]); // bottom of big grid top } } module gatering(){ h2 = wall + finegridheight; translate([0,0,fan/4-wall-finegridheight-1])difference(){ cylinder(r=fan*.8,h=h2); translate([0,0,-1])cylinder(r=fan*.65,h=h2+4); } // This makes openscad play nice with adding the grid to the funnel bit. } module finegrate(){ n = 2*offset; translate([0,0,n]){ finegratea(); finegrateb(); } } module lid(){ translate([0,0,fan/2-wall]){ difference(){ cylinder(r=fan,h=lidh); cylinder(r=fan-wall,h=lidh); for(i=[0:15:180]){ rotate([0,0,i])translate([-porthole/2,-fan*2,-fan/2+porthole])cube([portwidth,4*fan,fan/2]); } } for(i=[0,45,90,135]){ rotate([0,0,i]) intersection(){ cylinder(r=fan,h=lidh); translate([-wall/2,-2*fan,0])cube([wall,4*fan,2*fan]); } } } } module wholecylinder(){ difference(){ maincyl(); maincut(); } } module all(){ union(){ lid(); grate(); translate([0,0,0.1])finegrate(); // Move this by a hair so it can be combined with the large grid without problems. fanmount(); wholecylinder(); } } rotate([180,0,0])all(); //grate(); //finegrate();