Notifications
Clear all
[Closed] Multidimensional Arrays
Aug 19, 2011 3:55 pm
Hey guys,
I know this is an old hat and I know it’s covered in the help-file but I’m getting to a point that has not been covered in the help (Sorry Bobo).
How would I create a 3D array in Maxscript dynamically?
I thought of something like this
a=#(#(#()))
for lvi = 1 to 3 do
(
for lvj = 1 to 3 do
(
for lvk = 1 to 3 do
(
append a[lvi][lvj][lvk] 0
)
)
)
But I don’t get it to work. Could someone explain why this doens’t work and how I might get a 3D array to work?
Thanks in advance.
3 Replies
Aug 19, 2011 3:55 pm
I think that this: a=#(#(#())) is not 3d-array, as for ex. this: b = #(#()) is not 2d-array, but b = #(#(),#()) is 2d-array, so for ex. this w’d work:
b = #(#(),#())
for i=1 to 2 do (for j=1 to 2 do (b[i][j]=0))
--result: #(#(0, 0), #(0, 0))
Aug 19, 2011 3:55 pm
I think this is what you are looking for
x = #()
for a = 1 to 10 do
(
x[a] = #()
for b = 1 to 10 do
(
x[a][b] = #()
for c = 1 to 10 do
(
x[a][b][c] = random 0 100
)
)
)
Aug 19, 2011 3:55 pm
Thanks guys. That was exactly what I was looking for. Everything works fine now.:applause: