Add files via upload

This commit is contained in:
nyanotech 2025-11-21 01:45:52 -08:00 committed by GitHub
parent 84a4acf4d4
commit bee3544b54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,33 @@
// inner diameter of the small hexagons (the shorter of the two diameters)
hexagon_dia = 14;
// how thick the walls between hexagons should be
wall_thickness = 1.2;
// how many small hexagons are on each side of the big hexagon
layers = 3;
// the min height for a small hexagon
min_height = 50;
// the max height for a small hexagon
max_height = 100;
// 2, 11, and 14 work nice for 3-layer one, play around a bit
random_seed = 2;
rhombus_size = layers * 2 - 1;
hexagon_spacing = hexagon_dia + wall_thickness;
random_vals = rands(min_height, max_height, rhombus_size * rhombus_size, random_seed);
// form a rhombus
for (i = [0:rhombus_size - 1]) {
for (j = [0:rhombus_size - 1]) {
translate([i * hexagon_spacing * (sqrt(3) / 2), j * hexagon_spacing + i / 2 * hexagon_spacing, 0]) {
// cut off the two pointy ends of the rhombus
if (i + j > layers - 2 && i + j < rhombus_size + layers - 1)
difference() {
cylinder($fn = 6, h = random_vals[i * rhombus_size + j], d = (hexagon_dia + (wall_thickness * 2)) / (sqrt(3) / 2));
translate([0, 0, wall_thickness]) cylinder($fn = 6, h = random_vals[i * rhombus_size + j] + 1, d = (hexagon_dia / (sqrt(3) / 2)));
}
}
}
}