1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-16 19:54:29 +02:00

c-style for loop

This commit is contained in:
Justin Lin
2019-06-13 20:07:20 +08:00
parent 90d2f1ac9c
commit 3376b870a7

View File

@@ -26,7 +26,7 @@ module hexagons(radius, spacing, levels) {
tx = hex_datum[0][0], tx = hex_datum[0][0],
ty = hex_datum[0][1], ty = hex_datum[0][1],
n = hex_datum[1], n = hex_datum[1],
offset_xs = [for(i = [0:n - 1]) i * offset_step + center_offset] offset_xs = [for(i = 0; i < n; i = i + 1) i * offset_step + center_offset]
) )
[ [
for(x = offset_xs) [x + tx, ty] for(x = offset_xs) [x + tx, ty]
@@ -37,7 +37,7 @@ module hexagons(radius, spacing, levels) {
ty = hex_datum[0][1]; ty = hex_datum[0][1];
n = hex_datum[1]; n = hex_datum[1];
offset_xs = [for(i = [0:n - 1]) i * offset_step + center_offset]; offset_xs = [for(i = 0; i < n; i = i + 1) i * offset_step + center_offset];
for(x = offset_xs) { for(x = offset_xs) {
p = [x + tx, ty, 0]; p = [x + tx, ty, 0];
translate(p) translate(p)