Notifications
Clear all

[Closed] Get Group Layer

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
 //Or
 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?
thanks.
~sion

2 Replies

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>


foolayer = selection[1].layer
if foolayer.boxmode == true then
(
	foolayer.boxmode = false
)
else
(
foolayer.boxmode = true
)
--end

thanks a lot dude, worked like a charm.
~sion