Wish: Identifying selected object in Layers

I was looking for this or a similar request on the forum but did not find it.

I would love to see if you implemented Layers function which helps us identify the location of the object selected in the viewport in the Layers tree. You already have the option to select an object via the Layers tree and it gets selected in the viewport.

Thanks,
Andrej

import rhinoscriptsyntax as rs
import scriptcontext as sc
obj_ids = rs.GetObjects('Select objects')
indices = []
for obj_id in obj_ids:
    layer = rs.ObjectLayer(obj_id)
    indices.append(sc.doc.Layers.FindName(layer).Index)
sc.doc.Layers.Select(indices, True)

Hi @Mahdiyar ,

is this the code for highlighting layers when objects are selected? If yes, how can i implementit to V7?

Thanks,
Andrej

You can use Select Object Layer from the Hammer pulldown on the layers dialog to select objects layers.

1 Like