Make unique object group from multiple Array
Hi All
How to create a unique group of objects from multiple arrays?
This is an example of a known array of layers
layer1 = #("Sphere001","Sphere002","Sphere003") layer2 = #("Box001","Box002","Box003") layer3 = #("Tube001","Tube002","Tube003")
then I used the loop method like this with the results I wanted
ObjectGroup= #() for i=1 to layer1.count do ( for x=1 to layer2.count do ( for y=1 to layer3.count do ( groups = #(layer1[i], layer2[x], layer3[y]) ObjectGroup += #(groups) ) ) ) format "Total Result: %\n" ObjectGroup.count print ObjectGroup
which is a challenge and makes me stuck.
What if the array number of layers is not yet known and each layer has an unknown number of objects?
Can this be done using the recusive method? so how to make it?
Comments
Use join to join current array to the accumulator one. That's the direct reply to your question, but in the context of your question where you don't know the number of layers and their contents, it depends more on the way you collect those, to give a toy example with layers:
I say toy example as objs here would be the same as the global
objects
collection.Some of my scripts and MCGs :: 3ds Max SDK Intro for Scripters