ScriptSpot

Forum topic · General Scripting

turn object from same layer to box (boxmode)

By titane357 · 2012-11-21

Description

Hello

can anybody tell me how to make it work ?
"for obj in selection do obj.layer.Boxmode = true" don't work
if somebody can help, i need it to work with lot of trees
(I select one object of a layer, run the script all objects of the same layer have "moxmode" in object property)
Thanks

Comments (9)

titane357 · 2012-11-24

thanks for answer Anubis,
but I don't want "set #displayByLayer for your objs to True"
because I prefer working with display by object.

aha, ok, then...

Anubis · 2012-11-24

the code is changed really small:

if selection.count == 1 do
(
	--selection[1].layer.boxmode = true
	if selection[1].layer.nodes &theNodes do
		theNodes.boxmode = true
)

titane357 · 2012-11-26

thanks :-)

miauu · 2012-11-22

If you execute the script line by line in the maxscript editor, then there is no max version that will works with
local varName = something

titane357 · 2012-11-22

you are right... but I was tired :-)

titane357 · 2012-11-21

thanks a lot for answer !!!!
Miauu : max2013 don't like "local layerObjects", but it works fine without

Try this:

miauu · 2012-11-21


local layerObjects
		for o in selection do
		(
			o.layer.nodes &layerObjects
			for obj in layerObjects do obj.boxmode = true
		)

another method

barigazy · 2012-11-21


fn turnBoxMode state: = if selection.count != 0 do
(
local layersArr = #()
for o in selection where findItem layersArr o.layer.name == 0 do
(
append layersArr o.layer.name
selectionLayer = ILayerManager.getLayerObject o.layer.name
(refs.dependentNodes selectionLayer).boxmode = state
)
free layersArr
)
turnBoxMode state:on