mirror of
https://github.com/nyanotech/openscad_models.git
synced 2025-12-16 03:20:26 -08:00
Add files via upload
This commit is contained in:
parent
84a4acf4d4
commit
bee3544b54
33
models/hexagon_pen_holder.scad
Normal file
33
models/hexagon_pen_holder.scad
Normal 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)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user