Skip to content

Commit 4da430f

Browse files
committed
Cubic_Array() , Radial_Array() function added multiple child support
1 parent 28f1636 commit 4da430f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

array.scad

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ module Cubic_and_Radial_Array_Test()
3131
Cubic_Array(10,10,10,5,5,5,center=true)
3232
{
3333
sphere(2.5,center=true,$fn=60);
34+
cylinder(h=10,r=.5,center=true);
35+
rotate([90,0,0])
36+
cylinder(h=10,r=.5,center=true);
37+
rotate([0,90,0])
38+
cylinder(h=10,r=.5,center=true);
3439
}
3540

3641
//a linear array allong x can be derived from the cubic array simply
@@ -76,6 +81,9 @@ module Cubic_and_Radial_Array_Test()
7681
Cubic_Array(0,10,0,1,5,1,center=false)
7782
{
7883
cube([2,3,4],center=true);
84+
cylinder(h=10,r=.5,center=true);
85+
rotate([90,0,0])
86+
cylinder(h=10,r=.5,center=true);
7987
}
8088
}
8189

@@ -96,7 +104,7 @@ module Cubic_Array(sx,sy,sz,nx,ny,nz,center)
96104
for(z=[1:nz])
97105
{
98106
translate([x*sx,y*sy,z*sz])
99-
child(center=true);
107+
for (k = [0:$children-1]) child(k,center=true);;
100108
}
101109
}
102110
}
@@ -113,7 +121,7 @@ module Cubic_Array(sx,sy,sz,nx,ny,nz,center)
113121
for(z=[1:nz])
114122
{
115123
translate([x*sx,y*sy,z*sz])
116-
child();
124+
for (k = [0:$children-1]) child(k);
117125
}
118126
}
119127
}
@@ -134,6 +142,6 @@ module Radial_Array(a,n,r)
134142
{
135143
rotate([0,0,-(a*k)])
136144
translate([0,r,0])
137-
child();
145+
for (k = [0:$children-1]) child(k);
138146
}
139147
}

0 commit comments

Comments
 (0)