move selected objects to especific layer

Hi guys, how´s going?
i need a script to move selected objects to a specific layer (in this case, a layer named "**delete"). would be nice if the script create the layer if it does not exist.
Thanks in advance for any help.

Jsrocha

Comments

Comment viewing options

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

Glad you like it. :) The

Glad you like it. :)
The script can be optimized, so you can try to do it. :)

jsrocha's picture

I will do

I will do that!
cheers,

Jsrocha

jsrocha's picture

Thanks!

Hey Miauu, thnaks a lot man, that´s exactly what i need!
big, big thanks again!
cheers,

Jsrocha

miauu's picture

Try this:

macroscript MoveObjectToLayer
category:"miauu"
tooltip:"Move Objs To Layer"
buttonText:"Move Objs To Layer"
(
	on isEnabled return selection.count > 0 
	on Execute do
	(
		if (LayerManager.getLayerFromName "**delete") == undefined do
			layermanager.newLayerFromName "**delete"
 
		layer = LayerManager.getLayerFromName "**delete"
		for i in selection as array do (layer.addNode i)
 
	)
)

Comment viewing options

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