Last active
August 29, 2015 13:56
-
-
Save W4RH4WK/8897630 to your computer and use it in GitHub Desktop.
3D printed case for bits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module hexagon(size, height) { | |
boxWidth = size/1.75; | |
for (r = [-60, 0, 60]) | |
rotate([0,0,r]) | |
cube([boxWidth, size, height], true); | |
} | |
module combs(x_count, y_count, hex_size, wall_size, height) { | |
function x_pos(x, y) = (hex_size + wall_size) * x + ((y % 2 == 0) ? 0 : (hex_size + wall_size) / 2); | |
function y_pos(x, y) = (hex_size) * y; | |
for (x = [0 : x_count - 1]) | |
for (y = [0 : y_count - 1]) | |
translate([x_pos(x, y), y_pos(x, y), 0]) | |
rotate(30, [0, 0, 1]) | |
hexagon(hex_size, height); | |
} | |
module bitcase1(x_count, y_count, bit_size, wall_size) { | |
difference() { | |
cube([ | |
x_count * (bit_size + wall_size) + wall_size + ((bit_size + wall_size) / 2), | |
y_count * bit_size + wall_size * 2, | |
15]); | |
translate([bit_size / 2 + wall_size, bit_size / 2 + wall_size, 10]) | |
combs(x_count, y_count, bit_size, wall_size, 16); | |
} | |
} | |
module bitcase2(x_count, y_count, bit_size, wall_size) { | |
difference() { | |
cube([ | |
x_count * (bit_size + wall_size) + wall_size + ((bit_size + wall_size) / 2), | |
y_count * bit_size + wall_size * 2, | |
15]); | |
translate([0, - bit_size / 2 + wall_size, 10]) | |
combs(x_count + 2, y_count + 2, bit_size, wall_size, 16); | |
} | |
} | |
bitcase1(10, 5, 7.2, 1); | |
//bitcase2(10, 5, 7.2, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Scaling a 2d shape like hexagon seems to work in F5 mode, but that's not really intended.
Use
linear_extrude(height = ...) hexagon();
instead to produce the hexagon shaped 3d objects.