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

Layermanager.newLayerFromName

Layermanager.newLayerFromName "__delete"
DelLayer = LayerManager.getLayerFromName "__delete"
For obj in selection do DelLayer.addnode obj

You can't use the "**" in a layer name. This should do the trick. Also you can't create multiple layers with the same name so it wont hurt to run the first line multiple times.

Comment viewing options

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