Python-rhino3dm: Object name

Hello,

does anyone know how it is possible to give an object a name. I found in the rhino3dm documentation the class rhino3dm.ObjectAttributes but I don’t understand how to use it with created objects.

Thanks for answers

You could just use rs.ObjectName( object_id, your_object_name )…

But not in the rhino3dm. We are not talking about the same libraries. I am talking about this one:
https://github.com/mcneel/rhino3dm

OK, I changed the topic category to rhino3dm so it’s clear…

Ah, I understand. Thx.

Get the attributes, then check that for name. Here is how I used it with the 3dm importer for Blender 2.8:

I think your solution works only if you have a rhino file with objects. Then you can read the objects and get the access to the attributes. Im my case, when I create a new (for example) point:

`from rhino3dm import *`
`pt = Point3d(0,0,0)`
`pt.Attributes #<=Error because the pt object has no method like Attributes`

it doesn’t work.

I think only Rhino objects that actually exist in a document can have “attributes”… Things like layer, color, linetype etc. Pure geometrical RhinoCommon constructions like a Point3d do not have any of those.

Correct.

Ok, but it’s possible to create 3dm File with rhino3dm-library. In this file you have the “Default” layer and the objects which I created is on the default layer. Wherefrom rhino3dm knows on which layer the geometry should be created?

I’m not sure how far this has been wrapped, but you set the layer of an object by setting the LayerIndex on its attributes: https://mcneel.github.io/rhino3dm/python/api/ObjectAttributes.html#rhino3dm.ObjectAttributes.LayerIndex

@stevebaer can tell you better if this is already supposed to work or not.

Ok, thank you.

All of this is available in the rhino3dm package. You can create and add layers to a model, change object names and layer indices,…

Hi Steve,

could you make an short example how to give point object a name in rhino3dm.

Hi,
I know this thread has been inactive for quite a while, but I am wondering if someone could provide the mentioned example?
Side note - a few short tutorials (scripts demonstrating use of certain functionality) for rhino3dm library would bring much more users onboard!