Notifications
Clear all
[Closed] cube array
Jan 18, 2011 5:47 pm
how can i create a for loop to duplicate an object along the x, y and z axis, to form a cube
for example, I enter 4 and the object is duplicated in the formation of a cube 4 x 4 x 4 = 64 instances…
2 Replies
Jan 18, 2011 5:47 pm
use CloneNodes with offset…
see MXS help -> Interface: maxOps -> CloneNodes [left]<bool>maxOps.CloneNodes <&node array>nodes offset:<point3> expandHierarchy:<boolean> cloneType:<enum> actualNodeList:<node array> newNodes:<node array>
[/left]
Jan 18, 2011 5:47 pm
Something along these lines I’d guess…
fn CreateBoxArray obj spacing nr_cubes =
(
nr_cubes -= 1
for x_pos = 0 to nr_cubes do
for y_pos = 0 to nr_cubes do
for z_pos = 0 to nr_cubes do
if [x_pos,y_pos,z_pos] != [0,0,0] do
maxOps.cloneNodes obj cloneType:#instance offset: ([x_pos,y_pos,z_pos] * spacing)
)
setCommandPanelTaskMode mode:#create
CreateBoxArray selection[1] 15 4