Organizing, Hiding, Showing, Selecting Objects by Name

I’m migrating from a CAD program called Moment of Inspiration (aka MOI). It uses object names to organize objects. Not only have I gotten used to this, I have 100s of CAD models that are organized in this way.

Can Rhino display a list of object names with checkmarks, allowing one to hide and show objects by their object name? and perhaps another button for each object name that causes every object of that name to be selected? and another button that causes every selected object to be given that name?

I’ve seen on this forum how to use SelName and Hide/Show to handle some of this, but I don’t want to have to type in object names over and over. I’m looking for a nice list UI, very similar to the list of Layers.

Many thanks!

Hi @Christopher_Schardt

Rhino could be made to work this way; I think one could code a plugin I don’t know if there are any.

My only suggestion is to think of your objects as layers and treat them as such. Then everything you want to do is already there. Is your problem importing your moi models that are named?

I haven’t tried this script but looks like it would work.
This python script should converts object names to layer names.

import rhinoscriptsyntax as rs

obj = rs.GetObject(“Select an object to convert its name to a layer name”)
if obj:
# Get the object’s name
obj_name = rs.ObjectName(obj)
if obj_name:
# Check if a layer with the same name exists
if not rs.IsLayer(obj_name):
# Create a new layer with the object’s name
rs.AddLayer(obj_name)
# Move the object to the new layer
rs.ObjectLayer(obj, obj_name)
else:
print(“The object does not have a name.”)

This can be scripted if a list box is all you need. Now with eto forms maybe someone with more knowledge could make an object browser. It has been wished for.
RM

Nearly 3 decades of chat and forum postings have made it clear that the decision makers at McNeel are fundamentally opposed to anything of this sort and Rhino appears to be doomed to never have anything like it.

1 Like

Thanks RM! I understand that Layers gives me the functionality I’m looking for. The thing is that my existing 3DM files organize by object name and use Layers (called “Syles” in MOI) for color and other appearance characteristics.

Also, can I use your script in the Mac version of Rhino 8? My understanding is that it doesn’t support Rhinoscript.

It seems to me that I could really use a script that sets the layer of every object to one with the object’s name, creating the layer if necessary. Can someone tell me how to make that? (I’m a C++/ObjC/Swift programmer but don’t know Python.)

I’ve also discovered this concept in Rhino called “Selections”. A script that creates a Selection for every object name found in a model, and fills each Selection with the objects with matching names, would be most helpful! :slight_smile:

Hi @Christopher_Schardt

Sorry about that last python script it was ai generated and could have went bad in copying over. I’m not familiar with python and no programmer but attached is a Vbscript that auto creates layers from named objects.

You have to run the attached Vbscript in the Vbscript editor. Use the command edit script to open the editor. In the script if you select non named objects they are ignored, the layer names are created and then objects moved to them and then named objects are selected the named objects are also reported at the command line.

Being a C++ programmer you could program your wishes since that’s a deep language and rhino has C++ libraries etc.

Here’s the script but better to just download the attached file…

Option Explicit
'Script written by RM
'Script version Friday, October 3, 2025 12:32:37 AM

Call Main()
Sub Main()
Dim arrObjects, arrNames, strName,i,objects

arrObjects = Rhino.GetObjects("Selectobjects")

If IsArray(arrObjects) Then
	
	arrNames = Rhino.ObjectNames(arrObjects)
			
	If IsArray(arrNames)Then

		For i = 0 To UBound(arrObjects)

			strName = arrNames(i)
			Objects = arrObjects(i)

			If Not IsNull(strName) Then 
				Rhino.Print strName
				Rhino.ObjectsByName strName, True
				Rhino.AddLayer strName
				Rhino.ObjectLayer arrObjects(i), strName
		
			End If
		Next 
	End If
End If

End Sub

NameToLayer3.rvb (704 Bytes)

RM

Yeah, this is an ongoing saga to get an object manager:

I always love how people will tell you to just use Layer names instead. It’s a dumb workaround for something that should have been in Rhino since forever. It’s like instead of adding a heading to a piece of paper you instead label a folder for each individual sheet.

1 Like

Late to the party, but here is a quickie Python script from my library… Let me know if it needs to do something more.

ObjectNamesToLayers.py (437 Bytes)

1 Like

The other comments are closer to a better solution (and I Might be going a bit off-topic here by posting a sort of way of achieving this with GH) but I work on a lot of “horizontal” masterplan projects where it is quite easy for newcomers to the project to get lost so I tend to hand this definition “template” to them to make their life a bit easier.

Start by using the Geometry Pipeline component:

Then you can select the component holding the geometry, right click the empty canvas (or hold the mouse’s middle button) and select “Zoom” in the dropdown menu to narrow it down in the model space a bit easier:

And when visibility/locking is needed, I add in the Model Object and Visibility Attributes components and set a Boolean Toggle as an input for them. Then I set as an ouput the Content Cache component on the ‘Push’ action to update the changes in the Rhino environment (this can only be done in R8 with native components, if older versions are used, Elefront/Human or similar plugins will be needed to achieve this in GH):

Hope this helps

GeometryPipeline_SelectionFilter_AC_251003.3dm (42.6 KB)

GeometryPipeline_SelectionFilter_AC_251003.gh (22.0 KB)

1 Like

Hi @Alebrew

I was waiting for GH to chime in, nice work. I played with GH last night but only have elefont and it could do many things but was terrible at others or just too long winded so I used Vbscript which is way easier and more succinct.

Trying to use Gh on this I can really see it’s shortcomings for these things, since it was never meant to interact with Rhino. It’s a pain to try to change things like parsing text and changing text and iterating through arrays is just non sensical. But I know it can be made to work too bad GH doesn’t work more like excel where you have access to all sorts of sorting and text/code options. The list functions and the “dumb” text box that you can’t iterate through and change things without either writing you’re own functions or connecting yet more or other tools to, really is a bummer.

Instead of having to re-create the wheel which is how primitive GH kind of is, it should have pre made components that are parametric that can be changed by the user. Like all the properties in referenced geometry should be in one parametric battery that can be changed within the battery not just information that can only be changed downstream by really tiresome and cryptic/verbose methods.

RM

1 Like

Thanks 3dsynergy! I haven’t seen Basic code in a long time! It SEEMS like your code assumes that every object will have a unique name, which is not the case. Many objects will have the same name. (That’s how you organize them in MOI.) What happens when you execute “Rhino.AddLayer strName” and there already is a layer of that name? (If that’s a NOP then no problem I guess.) Also, why do have “Objects = arrObjects(i)” and then never use “Objects”?

Hi @Christopher_Schardt

It’s not great coding and most likely has flaws. It should put all objects with same name on that same layer name at least it worked for me. arrObjects(i) is used to select the named objects and put them on the named layer.

Mitch also posted a python script, and there are the nice GH scripts that Alessandro posted, these should give you a good starting point. I do understand your wish for an object browser, I think one with coding experience could make a plugin that does what you want with check boxes using eto forms and gridview and only works on named objects.

RM

The Python script I posted will only add a layer with the object name when the name is found for the first time. Subsequent objects with the same name will go to the same layer. Note Python scripts are case-dependent, so the same name with different capitalization will create a new layer. I did not make any allowance for that in this simple version. Also, objects with no names are not affected.

Edit - actually the Rhino internal layer function doesn’t care about capitalization, so no new layer will be created for different capitalizations and they will all go to the correctly named layer - for example Name, name, NaMe etc. will go to the same layer, the actual capitalization will be that of the first one found.

Thanks so much Helvetosaur. Your script works!

Now that I can see all my object names in the Layers panel, I find something missing: When I select an object, I expect to see some indication in the Layers panel of which layer the object is on. If multiple objects are selected, I expect to see the set of layers that have objects selected. I do see the Layer panel has a “Select Object Layers” command which does this, but what a pain to have to execute this command every time I change selection and what to see which layers are involved. Is there a way to make Rhino show this? If not, is there away of tying “Select Object Layers” to a keystroke? Thanks!