Script for creating new layer and hiding it


#1

Hi everyone.

I am a long time user of rhino but i never worked with scripts or grasshopper. i want to create a script that will do the following:
When i select an object (surface, crv or mesh)the script will make a new layer put the selected object in that layer and hide the layer.

Can this be done? how can I start doing this? I though about making a macro command but I couldn’t find a command to make a new layer.

Thank you you all :smile:


#2

rramot,

I have made buttons for this exact purpose. See the example. This button has right/left click commands.
The left click makes the layer T-TRIM nested under layer T-CASE, assigns selected objects to that layer, and turns the layer on. The right click does the same thing but turns the layer off. If the layer exists, the command just assigns objects to it and turns the layer on/off.

Jim


(Dale Fugier) #3

Hi Roi,

Drag & drop the attached script on top of a running Rhino. Then run “MoveToNewHiddenLayer”.

MoveToNewHiddenLayer.rvb (1.1 KB)

– Dale


#4

thak guys. ill try it out :slight_smile: