73 lines
1.5 KiB
OpenSCAD
73 lines
1.5 KiB
OpenSCAD
// https://en.wikipedia.org/wiki/Bitruncated_cubic_honeycomb
|
|
|
|
module _trunc_octa() {
|
|
octapoints = [
|
|
[+1, 0, 0],
|
|
[-1, 0, 0],
|
|
[0, +1, 0],
|
|
[0, -1, 0],
|
|
[0, 0, +1],
|
|
[0, 0, -1]
|
|
];
|
|
|
|
octafaces = [
|
|
[4, 2, 0],
|
|
[4, 0, 3],
|
|
[4, 3, 1],
|
|
[4, 1, 2],
|
|
[5, 0, 2],
|
|
[5, 3, 0],
|
|
[5, 1, 3],
|
|
[5, 2, 1]
|
|
];
|
|
|
|
intersection() {
|
|
scale(3) {
|
|
polyhedron(points=octapoints, faces=octafaces);
|
|
}
|
|
|
|
cube(size=4, center=true);
|
|
}
|
|
}
|
|
|
|
module _hollow_trunc_octa(wall) {
|
|
difference() {
|
|
_trunc_octa();
|
|
|
|
scale(1 - wall)
|
|
_trunc_octa();
|
|
}
|
|
}
|
|
|
|
module _3d_honeycomb(cells, wall) {
|
|
translate([2, 2, 2])
|
|
for (xi = [0 : cells[0] - 1]) {
|
|
translate([xi * 4, 0, 0])
|
|
for (yi = [0 : cells[1] - 1]) {
|
|
translate([0, yi * 4, 0])
|
|
for (zi = [0 : cells[2] - 1]) {
|
|
offset = (zi % 2 == 0) ? 0 : 2;
|
|
|
|
translate([offset, offset, zi * 2])
|
|
_hollow_trunc_octa(wall=wall);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
module 3d_honeycomb(dims, wall=0.2) {
|
|
intersection() {
|
|
translate([-2, -2, -2])
|
|
rotate([45, 0, 0])
|
|
_3d_honeycomb([
|
|
ceil(dims[0] / 4) + 1,
|
|
ceil(dims[1] / 4) + 1,
|
|
ceil(dims[2] / 2) + 1,
|
|
], wall=wall);
|
|
|
|
cube(dims);
|
|
}
|
|
}
|
|
|
|
//scale(2)
|
|
3d_honeycomb([16, 16, 16], wall=0.1); |