Help: Macro for Select objects in layers

I struggle to create a proper macro that will let me do the following:

  1. Select one or more objects (no matter if they are from the same or different layers);
  2. Click on the custom icon where the macro is stored;
  3. Rhino automatically selects all objects assigned to the same layer(s) like the pre-selected object(s).

Is it ever possible to do the above with a macro? Currently, I’m forced to use the “Highlight layers” script with a preliminary opened Layers tab in the Properties panel (which I usually keep closed), then locate the corresponding layer(s) and then right-click and choose “Select objects”. I need a more convenient solution to select objects from the same layer(s). That script does not work if the Layers tab is not opened. (683 Bytes)

This should do the job, I never had the occasion to test with multiple layers but I just did and it works as expected !

Edit : maybe I misunderstood and you want on top of that select only objects that are strictly the same ?

1 Like

Maybe try this one?: (253 Bytes)

1 Like

Both of these works exactly the way I described, thank you! They both work with pre-selected objects or selecting them afterwards. Great. :slight_smile: I will probably use the macro as it’s a bit quicker, while the script takes a brief time to load initially. Thanks again! :slight_smile: Not sure why Rhino lacks such a useful command by default.

1 Like

Yep, one of the little quirks of running Python scripts, at first run, the modules must be initialized/loaded and it takes a second. Once loaded, all following scripts run without any delay.

I run the following script automatically at startup - just make an alias (I use LoadPython) and then put the alias in Files > Commands to run when Rhino starts. When Rhino starts, it runs this small Python script (that does nothing except print “Python loaded!” to the command line) and doing that loads everything. Thereafter any other script runs instantaneously. It will make your Rhino startup time maybe a second longer. (142 Bytes)


That sounds great, I just struggle to follow your steps here. I can’t find any list with aliases in Files > Commands. However, there is a similar field in “Rhino options > General > Command lists”. When I place the path to the folder with your script there, Rhino shows the splash screen “forever” and fails to load any scene. It shows this:

Aliases are here: (Options>Aliases)

My alias does not have the full path to the script because I have set paths to where my scripts are stored in the Python script editor. If you have not done that then the alias needs to have the full path to the script file.

Once the alias works, then put it in the command list box.

1 Like

Thank you for the detailed explanation! I followed the steps you described and now all the scripts I use regularly load instantly. The one-second wait for each to load is eliminated. I think that there must be some thread on the top of the forum that teaches people important stuff like this, because they are quite useful.

1 Like