Highlight selected objects in Layers

Nope, this one is Windows only. Perhaps someone can rewrite it in Python; I am not sure if Layer dialog methods are available in RhinoscriptSyntax as they only recently have been added to RhinoScript, and the two are not in sync. Unless RhinoCommon has access to it.

–jarek

  • 1 for an option to turn on or off automatic layer highlight on selected object.

Why would Mcneel close the issue as ‘won’t fix’ if there are users that want it?

It could be an option that is set to false by default so that the average user wont get confused. It could be switched on by running a command, or changing the value in Advanced options to true.

We often have up to hundreds of layers, with deep nesting (its just the way we work) and it is time consuming to go through the layers looking for where the object belongs. Could be as simple as a dot or a highlight on the first tree branch to indicate where it lives.

@wim

1 Like

For now, here’s a py that does what I think you want:

import scriptcontext as sc
import rhinoscriptsyntax as rs

def HighlightLayers():
    
    ids = rs.SelectedObjects()
    if not ids:
        return
    
    layers = [rs.ObjectLayer(id) for id in ids]
    layers = list(set(layers))
    
    for layer in layers:
        parent = rs.ParentLayer(layer)
        while parent is not None:
            rs.ExpandLayer(parent, True)
            parent = rs.ParentLayer(parent)
            
    layers = [sc.doc.Layers.FindByFullPath(layer, -1) for layer in layers]
    sc.doc.Layers.Select(layers, True)
    
if __name__ =="__main__":
    HighlightLayers()

-Pascal