Click Box Programs

From i3Detroit
Revision as of 12:53, 24 March 2013 by Darvon (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Program which produces Top piece

height=60; width=120; depth=100; thick=3; ////end of user defined parameters


iwidth=width; iheight=height+4*thick; idepth=depth; ithick=thick; iwiggle=.05*ithick*0; ixhole=4*ithick+2*iwiggle; iyhole=1*ithick+2*iwiggle; isideholex=1*ithick+2*iwiggle; isideholey=3*ithick+2*iwiggle; ihinset=8*ithick; isideyinset=2*ithick; isidexinset=ithick;


//translate for dxf offset

translate(v = [10*ithick, 10*ithick, 0]) {

union() {

//paint the big square

square ([iwidth,idepth]);


//add the tabs

translate ([ihinset, -ithick]){ square([4*ithick,2*ithick]); }

translate ([iwidth-(ihinset+4*ithick), -ithick]){ square([4*ithick,2*ithick]); }

translate ([ihinset, idepth-ithick]){ square([4*ithick,2*ithick]); }

translate ([iwidth-(ihinset+4*ithick), idepth-ithick]){ square([4*ithick,2*ithick]); }

translate ([-ithick, (idepth-4*ithick)/2]){ square([2*ithick,4*ithick]); }

translate ([iwidth-ithick, (idepth-4*ithick)/2]){ square([2*ithick,4*ithick]); }


}//end the union for tabs


}// end translate for output

Program which produces Front piece

height=60; width=120; depth=100; thick=3; //end of user defined parameters


iwidth=width; iheight=height+4*thick; idepth=depth; ithick=thick; iwiggle=0; ixhole=4*ithick+2*iwiggle; iyhole=1*ithick+2*iwiggle; isideholex=1*ithick+2*iwiggle; isideholey=3*ithick+2*iwiggle; ihinset=8*ithick; isideyinset=2*ithick; isidexinset=ithick;


//translate for dxf offset


translate(v = [10*ithick, 10*ithick, 0]) {

difference () {

union() {

difference (){

//paint the big square

square ([iwidth,iheight]);

//cut 4 notches

translate([ihinset-iwiggle, ithick-iwiggle, 0]) { square([ixhole,iyhole]); }

translate([iwidth - (ihinset+iwiggle+ixhole), ithick-iwiggle, 0]) { square([ixhole,iyhole]); }

translate([ihinset-iwiggle, iheight -2*ithick-iwiggle, 0]) { square([ixhole,iyhole]); }

translate([iwidth - (ihinset+iwiggle+ixhole), iheight -2*ithick-iwiggle, 0]) { square([ixhole,iyhole]); }

} //end difference

//add the tabs

translate ([-2.1*ithick, ithick]){ polygon(points = [ [ithick, .5*ithick], [ithick,ithick], [4*ithick,ithick],[4*ithick,4*ithick], [ithick,4*ithick],[0,ithick]], paths = [ [0,1,2,3,4,5] ], convexity=1); }

translate ([iwidth+2.1*ithick, ithick]){ mirror([ 1, 0, 0 ]) { polygon(points = [[ithick, .5*ithick], [ithick,ithick], [4*ithick,ithick],[4*ithick,4*ithick], [ithick,4*ithick],[0,ithick]], paths = [ [0,1,2,3,4,5] ], convexity=1); } }

translate ([-2.1*ithick, (iheight-ithick)]){ mirror([ 0, 1, 0 ]) { polygon(points = [[ithick, .5*ithick], [ithick,ithick], [4*ithick,ithick],[4*ithick,4*ithick], [ithick,4*ithick],[0,ithick]], paths = [ [0,1,2,3,4,5] ], convexity=1); } }

translate ([iwidth+2.1*ithick, iheight -ithick]){ rotate(a = 180, v = [0,0,1]) { polygon(points = [[ithick, .5*ithick], [ithick,ithick], [4*ithick,ithick],[4*ithick,4*ithick], [ithick,4*ithick],[0,ithick]], paths = [ [0,1,2,3,4,5] ], convexity=1); } }


}//end the union for tabs

//cut the z slot

translate ([iwidth-4.9*ithick, ithick]){ polygon(points= [[0,0],[4*ithick,0], [4*ithick,2*ithick],[7*ithick,2*ithick], [7*ithick,3*ithick],[3*ithick,3*ithick], [3*ithick,1*ithick],[0,1*ithick]], paths=[ [0,1,2,3,4,5,6,7] ]); }

translate ([-2.1*ithick, (iheight-4*ithick)]){ polygon(points= [[0,0],[4*ithick,0], [4*ithick,2*ithick],[7*ithick,2*ithick], [7*ithick,3*ithick],[3*ithick,3*ithick], [3*ithick,1*ithick],[0,1*ithick]], paths=[ [0,1,2,3,4,5,6,7] ]); } translate ([iwidth+2.1*ithick, iheight -4*ithick]){ mirror(1,0,0){ polygon(points= [[0,0],[4*ithick,0], [4*ithick,2*ithick],[7*ithick,2*ithick], [7*ithick,3*ithick],[3*ithick,3*ithick], [3*ithick,1*ithick],[0,1*ithick]], paths=[ [0,1,2,3,4,5,6,7] ]); } } translate ([4.9*ithick, ithick]){ mirror(1,0,0){ polygon(points= [[0,0],[4*ithick,0], [4*ithick,2*ithick],[7*ithick,2*ithick], [7*ithick,3*ithick],[3*ithick,3*ithick], [3*ithick,1*ithick],[0,1*ithick]], paths=[ [0,1,2,3,4,5,6,7] ]); } }


} //end the difference


} // end translate for output

Program which produces Side piece

height=60; width=120; depth=100; thick=3; //end of user defined parameters


iwidth=width; iheight=height+4*thick; idepth=depth; ithick=thick; iwiggle=.05*ithick*0; ixhole=4*ithick+2*iwiggle; iyhole=1*ithick+2*iwiggle; isideholex=1*ithick+2*iwiggle; isideholey=3*ithick+2*iwiggle; ihinset=8*ithick; isideyinset=2*ithick; isidexinset=ithick;


//translate for dxf offset


translate(v = [10*ithick, 10*ithick, 0]) {

union() {

difference (){

//paint the big square


square ([idepth+4*ithick,iheight]);


//cut 6 notches


translate([isidexinset-iwiggle, isideyinset-iwiggle, 0]) { square([isideholex,isideholey]); }

translate([idepth-isidexinset-ithick-2*iwiggle+4*ithick, isideyinset-iwiggle, 0]) { square([isideholex,isideholey]); }

translate([isidexinset-iwiggle, iheight-isideyinset+iwiggle, 0]) { mirror([ 0, 1, 0 ]) { square([isideholex,isideholey]); } }

translate([idepth-isidexinset-ithick-2*iwiggle+4*ithick, iheight-isideyinset+iwiggle, 0]) { mirror([ 0, 1, 0 ]) { square([isideholex,isideholey]); } }


//cut cross holes

translate([(idepth-ixhole+4*ithick)/2-iwiggle, iheight-isideyinset+iwiggle, 0]) { square([ixhole,iyhole]);

}

translate([(idepth-ixhole+4*ithick)/2-iwiggle, ithick-iwiggle, 0]) { square([ixhole,iyhole]);

}

} //end difference


//add feet


translate([ithick,0, 0]) { circle(ithick); }

translate([idepth-ithick+4*ithick,0, 0]) { circle(ithick); }

}//end the union for feet

} // end translate for output