View Named Objects


#1

Is there a way to view named objects within Rhino as a list (similar to layers) so objects can be selected by name.

I know you can select named objects using _SelName but I could do with seeing a list of all named objects at once (not a pop-up) selecting and hiding easily in the same way you can interact with layers.

I often have to open MOI generated .3dm files and this seems to be how they are organised using layers for material options and named objects to name elements within the file.


#2

Hi John
Try the below Python script if helps you:

#-*- encoding:UTF-8 -*-
#Write by Vittorio Carlotto  carlottovittorio@gmail.com
import rhinoscriptsyntax as rs

def SelName():
    objs=rs.AllObjects()
    for ob in objs:        
       a= rs.ObjectName(ob)       
    names=[] # lista nomi vuota
    no_names=[]  # lista id oggetti senza nome vuota 
    for obj in objs:
        nome=rs.ObjectName(obj)
        if nome=='':
            nome='No_name'
            no_names.append(obj)#appende id oggetto senza nome
        names.append(nome)
    #print "senza nome", no_names
    l_nomi=set(names) # fa il cull della lista nomi
    #l_nomi=list(l_nomi)
    chek_nomi=[] # crea lista con l'aggiunta di False per il ChekListBox
    for n in l_nomi:
        cn=[n,False]
        chek_nomi.append(cn)
    names=rs.CheckListBox(chek_nomi)    
    l_names=[] # lista vuota oggetti da selezionare
    for el in names: # se il nome ha il chek
        if el[1]==True:
            l_names+=rs.ObjectsByName(el[0])
            if el[0]=='No_name':                
                l_names+=no_names    
    
    rs.SelectObjects(l_names)
    
SelName()

Ciao Vittorio


#3

Hi John
Or SelName without -
Ciao Vittorio


#4

Hi Vittorio,

Thanks for writing this so quickly (I’m completely new to scripting in Rhino and it’s fantastic what’s achievable with it)

Is there anyway the scrip can be modified so objects can be highlighted as they’re selected?

Also is there a way I can integrate this into my toolbars so it’s always displayed and I don’t have to load the scrip every time I want to use it?

Thanks in advance.