Tools: Hex Keys

From ShapeOko
Jump to: navigation, search

Allen wrenches:

Tools openscad hexkeys.png

(hexagon function by Kevin Crowley <caohaoim@gmail.com> )

module hexagon(r){
polygon(points=[[r,(r*(tan(30)))],
                [0,(r*(2/sqrt(3)))],
                [-r,(r*(tan(30)))],
                [-r,-(r*(tan(30)))],
                [0,-(r*(2/sqrt(3)))], 
                [r,-(r*(tan(30)))]]);
}
 
module hexkey (hex_size, hex_length, hex_blade) {
translate([-hex_size, -hex_size*2, -hex_size/2])
render(convexity = 1) {
intersection() {
cube(size=[hex_size*2,hex_size*2.501,hex_size*2.501]);
translate([hex_size, 0, hex_size*2.5])
rotate([0,90,0])
rotate_extrude()
translate([hex_size*2, 0, 0])
//rotate([0,0,90])
hexagon(hex_size/2);
}}
translate([0, 0, hex_size*2])
linear_extrude(height=hex_length-hex_size*2)
rotate([0,0,90])
hexagon(hex_size/2);
translate([0, -hex_size*2, 0])
rotate([90,0,0])
linear_extrude(height=hex_blade-hex_size*2)
rotate([0,0,90])
hexagon(hex_size/2);
}

hexkey (4,73,28);