Changing the layer of selected objects

I am a MAXscript noob and have done extensive searches on the subject but cannot seem to find a script which will allow me to change the layer of a selection of objects to an existing layer in the layer manager.

I have used the script listener to create the following simple script:

(
modPanel.addModToSelection (Turn_to_Poly ()) ui:on
maxOps.CollapseNodeTo $ 1 true
macros.run "Selection" "SelectInstances"
)

and would like to add script to change the layer to the current layer.

Is there anyone who can help me out?

Thanks!

Comments

Comment viewing options

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

.

Select some objects and run the script below. The object will be moved to the currently active layer:

(
	curLayer = LayerManager.current
	for i in selection as array do (curLayer.addNode i)
)

Comment viewing options

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