Skip to content

Instantly share code, notes, and snippets.

@W4RH4WK W4RH4WK/bit_case.scad
Last active Aug 29, 2015

Embed
What would you like to do?
3D printed case for bits
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);
@t-paul

This comment has been minimized.

Copy link

commented Feb 10, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.