Activate layer of selected object

Hi there :slight_smile:

When clicking an object(s) on a single layer, is there an option which allows it such that the layer becomes the active layer after the object(s) has been selected?

Best,
Jeremy

1 Like

try SetLayerToObject i think that will get you want you want, maybe? :wink:

1 Like

Wonderful, thanks so much kleerkoat.
That’s the exact command… the hope was to have this command run on every time I select an object, so that the layer is set to that object after clicking it!
Cheers

No, there is currently no option in Rhino to do this…

it is actually concept or idea from photoshop where you get the layer activr according to on what object you click …

What happens when you select objects on multiple layers?

Hi Helvetosaur,
Thanks for the answer.
Indeed, the hope was to replicate the feature in Adobe products like Photoshop, Illustrator and Indesign.
Possibly, to have this as an option which the user can change?

Cheers,
Jeremy

Hi Jeremy - what would be the advantage, apart from familiarity - can you describe how the workflow would benefit from this?

-Pascal

I’ve posted in the past about having the selected object’s layer highlighted.

Pascal I also don’t see the benefit in changing the active layer but it would only be a benefit to highlight the object’s layer… No downside I can think of.

I leave the little readout at the bottom set to show selected object layer for this reason but I think a highlight in the layer panel would be the ideal solution.

It would help you notice that you’ve gone off on a tangent and construct a bunch of stuff in the wrong layer and have to go back and reassign stuff afterwards.

Hello - maybe I am confused - are we talking about making a layer active/current or highlighting it in the layer panel?

-Pascal

The OP said activate.

I hijacked a little bit but suspecting the goal is really to get the layer bolded for visual reference rather than some functional reason. Maybe I’m wrong on that.

Hi Pascal :slight_smile:

Personally, I am constantly selecting (in layer tab) tools>select object layer then creating geometry on that layer.

If I select an object, and then want to create new geometry on that object’s layer, it requires select object layer, then activating it, then creation.

The alternative is to have an option, that when you select an object, rhino jumps to its layer and makes it the active layer.

This likely works when selecting objects on one layer, but if multiple objects were selected, perhaps rhino could activate the layer of the first object that was selected and highlight the rest.

Aside from the active layer option, I’m in agreement with Ryan. I think it would be great that if objects on multiple layers were selected, that rhino would highlight them just like ‘tools>select object layer’.

And in alignment with my previous post’s topic, the user has the option to select all objects on those layers by right clicking the highlighted blue, select objects/sublayer objects.

If these ideas were possible, they could be made as options for the user, or a command which switches them on or off

-Jeremy

Hi Jeremy - thanks -

This has not come up before that I can recall. I don’t really have a sense of how prevalent that is as a workflow consistent enough to warrant a sticky behavior and happen every time I select something - certainly it would drive me batty… would a single F-Key with SetLayerToObject work?

Highlighting layers is a different thing… RH-39104 Highlight selected object layers

-Pascal

in Microstation when I CLICK an object AND press ALT key current attributes (active level, color, line type and weight…) are matched to the object I just selected.
It is a useful shortcut sometimes

1 Like

Hi Luca,
Something like this sounds absolutely ideal. Indeed Microstation has its advantages in this regard.

Cheers for the suggestion!

Hi Pascal,

I’m not entirely sure of how many people use Rhino>Adobe software workflow, but many of my architecture student friends and I do this. It’s a great way to get fine drawings done.

This occurs most obviously in Illustrator; when you select an object, it takes you to it’s layer and you start drawing on that layer.

As Luca has mentioned, to have this possibly like they do in Microstation where Alt clicking the object takes you to its layer could be a quick solution. However, the option or command to toggle this on or off could be good too as it doesn’t require two hands.

-Jeremy

Hi Jeremy- you can have this now, in effect, if you put SetLayerToObject on an unused F-key. Any time you tap that with an object selected, you get that layer current. ?

-Pascal

2 Likes

Hi Pascal,

This seems like a pretty good solution, thank you :slight_smile:
I added the python script (below) as F2, and then SetLayerToObject as F3. A quick tap of each gets me exactly where I want to be :slight_smile:

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()

-Jeremy