View Full Version : Get Group Layer

01 January 2009, 08:37 AM
Hey guys,

I put all of my vray proxy stuff on a seperate layer, most of them are grouped.
I set the layer display to bounding box to save performance, and back to shaded to make adjustments.
Now, I want to write a script that:
-Determine the layer of the selected object(s).
-Set that Layer display mode to box.

foo = $.layer
foo.boxmode = true
foo.display = #boundingbox (not sure about this syntax)

The problem is most of proxy stuff are grouped, so when I select a group and try to anything on the $ max simply returns an error, listing $ gives me back $selection instead of the usual node properties $Editable_Meshetcetc, this the first time I deal with groups with maxscript and for some reason they are not treated as nodes.
any help guys?

01 January 2009, 10:41 AM
groups are object sets. you can check "ObjectSet Values" in maxscript reference for more help.

there is a .count method to get the group's object count. then you can find any other object with selection[<index>] method:

myselection = $; --or: myselection = selection
for i=1 to myselection.count do
thisobj = myselection[i]
move thisobj [(i*10),0,0]

thisobj is a node/object from the group...

also you can use this for single objects to set them as bounding boxes in viewports:
<node>.boxMode = <true/false>

01 January 2009, 12:45 PM
foolayer = selection[1].layer
if foolayer.boxmode == true then
foolayer.boxmode = false
foolayer.boxmode = true
thanks a lot dude, worked like a charm.

CGTalk Moderation
01 January 2009, 12:45 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.