Unique ID for Layers?

Is there a way to access a unique ID for a layer with Python?


Yep -


import scriptcontext as sc

L = sc.doc.Layers.FindName("Layer 01")
id = L.Id


Hello Pascal,
Thanks for your response.

This one throws an error for me.

I researched more and ended up using this:

import rhinoscriptsyntax as rs
import scriptcontext as sc

LayerNames = rs.LayerNames()
for Layer in LayerNames:
    #   get unique Layer ID
    LayerID = rs.LayerId(Layer)
    print LayerID