turn object from same layer to box (boxmode)

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

looks like duplicated thread...

I answer to you here:
http://www.scriptspot.com/forums/3ds-max/general-scripting/turn-object-f...

before seeing this topic

<node>.layer.<property> = <value> works fine!
just need to set #displayByLayer for your objs to True ;)

my recent MAXScripts RSS (archive here)

titane357's picture

thanks for answer Anubis, but

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

Anubis's picture

aha, ok, then...

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
)

my recent MAXScripts RSS (archive here)

titane357's picture

thanks :-)

thanks :-)

miauu's picture

If you execute the script

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's picture

you are right... but I was

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

titane357's picture

thanks a lot for answer

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

miauu's picture

Try this:

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

another method

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

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.