Getting started with rhino3dm.py - selecting objects

This may possibly be a very silly or trivial question, but having discovered rhino3dm.py today I can’t understand how to find the object in a file I want to work with.

Say I have an existing 3dm file created in rhino containing multiple surfaces with user text attached to each. Later I want to use a python script with rhino3dm to find a particular surface (identified by the attached user data) in the model file, and change its layer, for example.

Or in fact, say I want to change the layer of every single surface in the file?

It seems I’d probably use rhino3dm.ObjectAttributes.Layerindex() to change the layer, but how do I select the surface(s) that I want to change/pass to LayerIndex as parameters?

If writing a script in rhino I’d use rhinoscriptsyntax.ObjectsByType() or similar - what is the equivalent in rhino3dm.py?

Hi Ferg,

Not working with rhino3dm.py, but maybe my pointers can help.

You can go through all objects in the ObjectTable (https://mcneel.github.io/rhino3dm/python/api/File3dmObjectTable.html)

You can query each object for the existence of the user text

I guess with File3dmObject.Attributes.GetUserString(key)
But I’m not sure if that is available this way for rhino3dm.py

-Willem

Thanks very much Willem, it certainly does seem like File3dmObjectTable is part of the answer to my situation.

I’ve also since found these examples: https://github.com/mcneel/rhino3dm/tree/master/docs/python/samples
which I hope will help anyone in a similar situation.