Automatic layer organizer

Hello everyone,

I wonder if there is a script, add on, etc to make this a thing.
By this I mean that items would automatically fall into their corresponding layer based on their characteristics.
For example: You got a layer named “hatch” with red color.
So all hatches you do with red color will fall into that layer no matter what.
Now you make a circle, it falls under the layer “circle”.
etc etc. There could be custom settings so that circles maybe fall into the “curves” layer. In this way you can have pre arrenged profiles for your documents.

Its very tedious to be changing every object you draw or model into a specific layer.
Anyone has any workarounds?

Thanks in advance

for a simpler form of what you want, you could make a macro or a new command which would consist of 2 given commands, SelHatch and ChangeLayer if somebody still could add a hint how to address one specific named layer like for example hatch then it would work with one alias or one command without pop up but till then you at least could make that work to this point with one short cut or alias.

and if you want that to happen automatically each time this script or function would have to be appended to each command which creates anything, so that may not be so easy, but a script which runs over it once or each time you hit it which selects each entity placing it in the appropriate layer should work though, and combining color and kind of entity may also work but i have no idea how to script it so for now thats all i can offer here.

@Helvetosaur any idea how layers can be addressed directly without popup window asking which layer i want? something like ChangeLayer_ANYname_Enter?

i put both commands in the script box and it works just that it pops up the layer window asking which one i want.

1 Like

@RichardZ, just use the hyphen in front of the command so it does not open the dialog:

_-ChangeLayer “YourLayerName”

Note that when “YourLayerName” does not exist, nothing will happen. If the layer name has spaces in it, surround it with quotes.


1 Like

yes it works now thanks @clement, have tried with quotes like _ChangeLayer"Hatch" and i think i also tried with a space between the command and the quoted name but never by the might of grayskull would i have came to the conclusion to use a hyphen. i think its a good idea at this point to read through the help file and have found it there, but i still cant figure out how to use this line for several commands for example something like

_-ChangeLayer “Hatch”
_-ChangeLayer “Dim”

if run the above it just throws it all into the the Dim layer. i also tried _pause , _enter, _EnterEnd in between and ! before the second is that possible at all? and how would i implement that it creates such a layer if not existing?

I suppose (haven’t run that macro) that’s because the hatches are still selected. Throw in a None to deselect.

1 Like

That’s _SelNone:wink: --Mitch

Regular None has always worked for me! :sunglasses:

Really ? That’s not a listed command… Must be some kind of undocumented internal alias… Never knew that, thanks!


Short is beautiful… (and I’m 1.98…)

holy moly a real pandeinós here :joy:
thanks guys for peeping in both work SelNone and None. when you have several objects stacked on top of each other and you click, the choose object pop up appears and it includes also None below maybe thats where it came from at least its somehow implemented.

to conclude for @ShynnSup

_-ChangeLayer "Hatch"
_-ChangeLayer "Dim"

seems to work, you can throw in any addition if you have the prepared Layer
Circle will not work since rhino does not know what a circle is but curves work.

just create a new command and throw the line above in exactly like that you can address it with one short cut and it whoops it all into the appropriate prepared layers hope that helps for now.

@Helvetosaur and @wim and whoever reads this, to one question from above again, how would i implement that it creates a layer within the script box when the layer is not already there, with a predefined name maybe even with a layer color?

@RichardZ, creating a layer would be macroed like this:

_-Layer _New "Hatch"

The good thing is, it creates the layer only once and when you run it again while the layer exists already, it does not create a new one. So you can run it without harm. The coloring would be done like this:

_-Layer _Color "Hatch" 255,0,0 _Enter

but the layer must exist for this to happen. I think if you do these kind of tasks with a script is better suited since it allows to control everything like colors, sublayers etc.


thanks @clement creating new layers works like that, but not defining the layer color even if the layers already exist. it still pops up a window asking what i want to address, i must add i am trying that on a mac so maybe the syntax is different there. can you double check if your line is correct and if so i will move this to a new topic for mac.

Note that the layer must exist for the color change. Only tested on windoze, maybe @Helvetosaur can take a look if the mac fails to script the command.


No Mac with me right now, have to wait until I get home - or someone else can test before… --Mitch

Hi @RichardZ - I’m trying to make a Macro button that will fill a closed curve with a specific Hatch (ANSI31) from my dropdown list of Hatches. I’d basically like to Left Mouse clicking my Macro Button to automatically do the following:

  1. Fill the Closed Curve with my ANSI31 Hatch
  2. Apply the subsequent ANSI 31 Hatch Object to my “Hatch Wall” Layer (regardless of whether it is the Current Layer)

Just can’t seem to figure out how to have a specific Hatch selection happen in the Macro. I’ve tried the Hyphen trick, I’ve tried GetString (which I think only works in Scripting) and I’ve tried _Pattern=ANSI31. None seem to do the trick.

Ultimate goal, for those following this thread, will be to use that as my Left Mouse Button selection on the Macro Button, and the Right Mouse Button will be a SOLID Hatch that will go in my “Hatch Solid” layer.

Help would be appreciated, thanks!

Hi Alan - try

! -Hatch Pause Enter Pattern "Hatch1" Enter

! -Hatch Pause Enter Pattern "Solid" Enter

does that do anything you like?


Yessir. Yes it does.:joy:

Thanks as always.

And here’s the full Macro, in case anyone’s interested (My hatch and layer names in this case):

! -Hatch Pause Enter Pattern “ansi31” Enter
None Sellast
-ChangeLayer “Hatch Wall”

1 Like

Ok, so, I have this macro, which will take a single OPEN CRV and offset, cap it, create a hatch, and place that hatch on a specified layer (Great for anyone out there who set design btw!)

! Offset _Pause _Pause _Enter
_Selnone _Sellast
-Hatch Pause Enter Pattern “ansi31” Enter
None Sellast
-ChangeLayer “Hatch Wall”

Here’s are two things I’d like to have it also do:

  1. Set the Distance in the Offset to 3" (I’ve done this in the past but can’t seem to remember how – and I had a computer meltdown and lost my toolbars!)

  2. I would like to be able to have the macro COPY THE ORIGINAL CRV, then go through its whole thing I have written up there, and then DELETE THE CLOSED CRV, and PASTE THE ORIGINAL CRV back into place. So I’d like it to look like this in the end:

I’ve tried some obvious stuff like “! Copy InPlace Enter” etc, but not getting any love.


Thanks as always, and hope some of you can use that macro for yourselves!

One word: Scripting. It seems like you’re getting complex enough requirements that a script is in order…

That said, this may work:

! Copy _Pause _InPlace _SelNone _SelLast _Offset _Cap=_Flat 
_Distance 3 _Pause _Pause _Enter
_Selnone _Sellast _SetObjectName "Temp"
-Hatch Pause Enter Pattern "ansi31" Enter
_SelNone _SelLast 
-_ChangeLayer "Hatch Wall"
_SelNone _-SelName "Temp" _Delete


1 Like