I've been trying to get my head around some max script where I have a loop and I want to create and populate some arrays within the loop. I already have an array which I can use to name. -- get all object namesAllobjects = for g in geometry collect g.name-- get base object namesfor a=1 to Allobjects.count do( s =…
I avoid using execute if possible, just on principle. There are very few cases where it is strictly necessary. This is how I would do what you are trying:b = for obj in (selection as array) where (matchpattern obj.name pattern:"sphere*") collect obj this collects the stuff in the loop which matches the criteria after the…
Cheers dude, that allowed me to access the objects quicker than the string filtering but I was after generating the array names dynamically. I'm not sure if that's possible so I managed to get around it by using a temporary array and filling that in a loop instead. It means I have to do a few more calculations each time it…
Thanks that's pretty neat, it's better than what I did: NamesArrayCopy[p] = ("$" + NamesArray[p] + "*")TempArray = (execute NamesArrayCopy[p]) as array I'd read that using execute should be avoided unless really necessary but I don't know the reasons why. I'm guessing performance.
As far as I know, execute() would be the only way to dynamically generate (and subsequently access) variable names (I tend to abuse the hell out of it to generate my rollouts).