1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-05 14:27:45 +02:00

refactored

This commit is contained in:
Justin Lin
2017-05-29 17:43:55 +08:00
parent 7253b9bb9f
commit c335b4ab82

View File

@@ -23,13 +23,15 @@ module hexagons(radius, spacing, levels) {
rotate(30) rotate(30)
circle(r_hexagon, $fn = 6); circle(r_hexagon, $fn = 6);
} }
function offset_xs(n) =
[for(i = [0:n - 1]) i * offset_step + center_offset];
module line_hexagons(n) { module line_hexagons(n) {
for(i = [0:n - 1]) { for(x = offset_xs(n)) {
offset_p = [i * offset_step + center_offset, 0, 0]; translate([x, 0, 0])
translate(offset_p)
hexagon(); hexagon();
} }
} }
line_hexagons(beginning_n); line_hexagons(beginning_n);
@@ -47,4 +49,4 @@ module hexagons(radius, spacing, levels) {
line_hexagons(n); line_hexagons(n);
} }
} }
} }