H = 87; //Height of main section cube Ratio =0.6; //Height to Width Ratio //S = 40; //Width of each side, use this to ignore the proper H/W ratio S = H * Ratio; //Width of each side Dh = H - S/3.5; // Door Height Dw = 2 * S/5; // Door Width Po = (-Dh + 8 * S / 5) / 3; // Panel Offset Pr = Dw - (2 * Po); // Panel Size HD = S-15; // hollow rectangle width ledHoleDiameter=5; MinOverhangSlope=tan(30); HH=HD*MinOverhangSlope; $fn = 100; echo(MinOverhangSlope); color([0,0,0.7]) difference() { union() { //Main Box cube([S,S,H]); //Middle Box translate([S/20,S/20,0]) cube([S-(S/10),S-(S/10),H+(S/15)]); //Top Box translate([S/10,S/10,0]) cube([S-(S/5),S-(S/5),H+(S/7.5)]); //Roof polyhedron( points=[ [S/2,S/2,H+(S/5)],[S/10,S/10,H+(S/7.5)],[S/10,S-S/10,H+(S/7.5)], [S-S/10,S-S/10,H+(S/7.5)],[S-S/10,S/10,H+(S/7.5)]], triangles=[ [0,1,2], [0,2,3],[0,3,4],[0,4,1],[1,3,2],[1,4,3] ] ); //Bottom Fringe translate([-S/10,-S/10,0]) cube([S + S/5, S + S/5,S/10]); translate([-S/10,-S/10,0]) polyhedron(points= [ [0,0,S/10], [S + S/5,0,S/10], [S + S/5,S + S/5,S/10], [0,S + S/5,S/10], [(S + S/5)/2,(S + S/5)/2, S/2.5] ], triangles = [ [0,4,1], [1,4,2], [2,4,3], [3,4,0], [0,1,2], [0,2,3] ] ); //Name Plates translate([S/25,-1,H-S/3.5+3*S/20]) cube([S-2*S/25, S + 2, S/3.5-3*S/20]); translate([-1,S/25,H-S/3.5+3*S/20]) cube([S + 2, S-2*S/25, S/3.5-3*S/20]); } //Faces for(i=[0,90,180,270]) { translate([S/2,S/2,0]) rotate([0,0,i]) translate([-S/2,-S/2,0]) face(); } //Hollowing Out union() { translate([S/2-HD/2,S/2-HD/2,-1]) cube([HD, HD,H-HH+S/5+1.01], center=false); translate([S/2, S/2, H-HH+S/5]) pyramid(square=true, side=HD, height=HH, centerHorizontal=true); //cylinder(H - S/5 - 1, r = HD/2); //translate([0,0,H - S/5 - 1]) sphere(r=S/2.5); //translate([0,0,H - S/5 -1-.01]) cylinder(S/2.5,HD/2,Lr); } //Print just the top for testing //translate([-S/2,-S/2,-1]) cube([2*S,2*S,H-HH+S/5]); //LED hole translate([S/2, S/2, H-S/5]) cylinder(h=S, r=ledHoleDiameter/2); translate([S/2, S/2, H-S/5]) cylinder(h=S/3, r=ledHoleDiameter/2+1); } module face() { render() color([0,0,0.5]) translate([0,-1,3 * S/20]) union() { translate([2*S/25,0,0]) cube([Dw,2,Dh]); translate([13*S/25,0,0]) cube([Dw,2,Dh]); color([0,0,0.4]) for(i=[2*S/25 + Po,Po + 13*S/25]) { for(j=[0,1,2]) { translate([i,0,(j+1) * Po + j * Pr]) cube([Pr, 3, Pr]); } difference(){ translate([i,0,4 * Po + 3 * Pr]) cube([Pr, 3, Pr]); translate([i,0,4 * Po + 3.5 * Pr -0.5]) cube([Pr,4,1]); translate([i+Pr/3-0.5,0,4 * Po + 3* Pr]) cube([1,4,Pr]); translate([i+2*Pr/3-0.5,0,4 * Po + 3* Pr]) cube([1,4,Pr]); } } } } //courtesy of randyy's OpenSCAD Parts Library //http://www.thingiverse.com/thing:6021 module pyramid(side=10, height=-1, square=false, centerHorizontal=true, centerVertical=false){ // creates a 3 or 4 sided pyramid. -1 height= tetrahedron or Johnson's Solid square pyramid mHeight= height!=-1 ? height: square == true ? (1/sqrt(2))*side: //square sqrt(6)/3*side; //tetra vert= centerVertical!=true ? [0,0,0]: square==false ? [0,0,-mHeight/4] : //inscribes a tetra inside a sphere, not 1/2 ht [0,0,-mHeight/2]; //for squares, center=false inscribes, so true is just 1/2 ht horiz= centerHorizontal!= true ? [0,0,0] : square == true ? [-side/2, -side/2, 0] : //square [-side/2,-sqrt(3)*side/6 ,0]; //tetra translate(vert+horiz){ if (square == true){ polyhedron ( points = [[0,0,0],[0,side,0],[side,side,0], [side,0,0],[side/2,side/2,mHeight]], triangles = [[1,0,2], [2,0,3], [0,4,3], [3,4,2], [2,4,1], [1,4,0]]); } if (square != true){ polyhedron ( points = [[0,0,0],[side,0,0],[side/2,sqrt(3)*side/2,0], [side/2,sqrt(3)*side/6,mHeight]], triangles = [[0,1,2], [1,0,3], [2,1,3],[2,3,0]]); } } }