# Python-rhino3dm: Object name

**URL:** <https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192>\
**Category:** rhino3dm\
**Created:** [November 22, 2018, 7:38am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192 "2018-11-22T07:38:14Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimitrij.m](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dimitrij.m/32/111616_2.png) [@dimitrij.m](https://discourse.mcneel.com/u/dimitrij.m)\
**Post date:** [November 22, 2018, 7:38am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/1 "2018-11-22T07:38:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [November 22, 2018, 8:28am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/2 "2018-11-22T08:28:35Z")

</div>

You could just use rs.ObjectName( object\_id, your\_object\_name )…

---

<div class="post-metadata">

**Author:** ![dimitrij.m](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dimitrij.m/32/111616_2.png) [@dimitrij.m](https://discourse.mcneel.com/u/dimitrij.m)\
**Post date:** [November 22, 2018, 8:31am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/3 "2018-11-22T08:31:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [November 22, 2018, 8:32am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/4 "2018-11-22T08:32:45Z")

</div>

> [@dimitrij.m](#):
>
> But not in the rhino3dm

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

---

<div class="post-metadata">

**Author:** ![dimitrij.m](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dimitrij.m/32/111616_2.png) [@dimitrij.m](https://discourse.mcneel.com/u/dimitrij.m)\
**Post date:** [November 22, 2018, 8:41am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/5 "2018-11-22T08:41:57Z")

</div>

Ah, I understand. Thx.

---

<div class="post-metadata">

**Author:** ![nathanletwory](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/nathanletwory/32/482880_2.png) [@nathanletwory](https://discourse.mcneel.com/u/nathanletwory)\
**Post date:** [November 22, 2018, 5:23pm UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/6 "2018-11-22T17:23:50Z")

</div>

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

> <https://github.com/jesterKing/import_3dm/blob/9e8843848f482cc5f156151ba7c60e05641be46f/import_3dm.py#L245>

---

<div class="post-metadata">

**Author:** ![dimitrij.m](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dimitrij.m/32/111616_2.png) [@dimitrij.m](https://discourse.mcneel.com/u/dimitrij.m)\
**Post date:** [November 23, 2018, 7:35am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/7 "2018-11-23T07:35:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [November 23, 2018, 8:06am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/8 "2018-11-23T08:06:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nathanletwory](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/nathanletwory/32/482880_2.png) [@nathanletwory](https://discourse.mcneel.com/u/nathanletwory)\
**Post date:** [November 23, 2018, 9:57am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/9 "2018-11-23T09:57:16Z")

</div>

> [@Helvetosaur](#):
>
> Pure geometrical RhinoCommon constructions like a Point3d do not have any of those

Correct.

---

<div class="post-metadata">

**Author:** ![dimitrij.m](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dimitrij.m/32/111616_2.png) [@dimitrij.m](https://discourse.mcneel.com/u/dimitrij.m)\
**Post date:** [November 23, 2018, 10:53am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/10 "2018-11-23T10:53:52Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![nathanletwory](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/nathanletwory/32/482880_2.png) [@nathanletwory](https://discourse.mcneel.com/u/nathanletwory)\
**Post date:** [November 23, 2018, 11:09am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/11 "2018-11-23T11:09:52Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![dimitrij.m](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dimitrij.m/32/111616_2.png) [@dimitrij.m](https://discourse.mcneel.com/u/dimitrij.m)\
**Post date:** [November 23, 2018, 11:50am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/12 "2018-11-23T11:50:49Z")

</div>

Ok, thank you.

---

<div class="post-metadata">

**Author:** ![stevebaer](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/stevebaer/32/473567_2.png) [@stevebaer](https://discourse.mcneel.com/u/stevebaer)\
**Post date:** [November 23, 2018, 4:35pm UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/13 "2018-11-23T16:35:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dimitrij.m](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dimitrij.m/32/111616_2.png) [@dimitrij.m](https://discourse.mcneel.com/u/dimitrij.m)\
**Post date:** [November 26, 2018, 7:22am UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/14 "2018-11-26T07:22:33Z")

</div>

Hi Steve,

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

---

<div class="post-metadata">

**Author:** ![kazet](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/kazet/32/691073_2.png) [@kazet](https://discourse.mcneel.com/u/kazet)\
**Post date:** [May 11, 2020, 7:13pm UTC](https://discourse.mcneel.com/t/python-rhino3dm-object-name/75192/15 "2020-05-11T19:13:54Z")

</div>

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!
