_SelSameName?

Would there, could there be a macro for selecting objects with the same name?
Currently -Selname Select does not work with preselection

Hi Toni - - scriptable -SelName Select Enter with pre-selection should work - as it does with

-SelLayer Pick Enter

, but does not. Not to mention the option name should match. Thanks for pointing this out, I’ll see if we can get it fixed.

-Pascal

1 Like

Hi @Toni_Osterlund,

Here is a Python script that may help.

SelSameName.py (592 Bytes)

– Dale

1 Like

Thanks @pascal @dale
So python it is.

I re-wrote Dale’s idea to a button.
Seems to work. Good for now.

_NoEcho _-RunPythonScript (
#! python 2
import scriptcontext as sc
import rhinoscriptsyntax as rs

def SelSameName(objs):
    rs.EnableRedraw(False)
    names = []
    for obj in objs:
        name = rs.ObjectName(obj)
        if name != None:
            names.append(name)
	if len(names) > 0:
		for rh_obj in sc.doc.Objects:
			for name in names:
				if rs.ObjectName(rh_obj) == name:
					rs.SelectObjects(rh_obj)

    rs.EnableRedraw(True)

selection = rs.SelectedObjects()
if len(selection) == 0:
    selection = rs.GetObjects("Pick objects",0,False,True,True)
    if not selection: Exit
    
SelSameName(selection)
)