Notifications
Clear all

[Closed] Quicky about grouping an array

Hi,

I have a variable that is a string of objects in my scene.

Does anyone know how to group these? My variable is called objs

“5ftb001” is the first object in the array of objects

Ive tried:

group objs

but get this error:
– Runtime error: operation requires a collection of nodes, got: “5ftb001”

6 Replies

I suggesting the there is a problem in your code,

ie, objs isn’t an array

maybe you should post some more so we can debug it for you.

J.

Oops, sorry I am very new to maxscript.

I will explain a bit more. I have a script that merges objects from another scene and the variable that lists the objects is objs

So if I type objs into the listener I get
#(“5ftb001”, “Tblgt001”, “wn_gls001”, “smfrk001”, “smknf001”)

so what I am trying to do is group this string of objects together once they have merged and thought that

group objs

…would do the trick but evidently not

well maybe there are two things that could be happening. Either you’re doing something to the array obj so it is no-longer an array, or 5ftb001 isn’t a valid object for an array.

I can’t offer any more help with just a description of code. try this:


bx=for i=1 to 10 collect b=box()
group bx

works as expected.

Josh.

Hi
you need an array of abjects, not an array of strings !

try this:

objs=#(“5ftb001”, “Tblgt001”, “wn_gls001”, “smfrk001”, “smknf001”)
objs2= for objName in objs collect (getnodeByName objName)

group objs2

Hope this helps

well spotted ZB!

Right, I understand what your saying now, it couldn’t group the array because it was just a list of names not actual objects.

Thanks a lot

Spencer