Get objects under certain layers via rhino3dm api

Hi everyone,
I’m working on a python script with rhino3dm api where I have imported a .3dm file, and wanna get objects under certain layers by layer names to do some analysis. However, I was only able to find Name & LayerIndex properties under ObjectAttributes class:


Is there some way to extract layer name via rhino3dm api?

From the layer index you should be able to get the layer name via the layer table.

Normally, in Python I would get the layer table with something like layers=scriptcontext.doc.Layers, but perhaps also via layers=File3dmLayerTable Then with the index, you can use layer=layers.FindIndex(index) which will give you the layer, and name=layer.FullPath which gets the full layer name including parents if it’s nested.

1 Like

Got it! With your tips I’ve solved my issue. Thanks a lot!