# Set MText Attachment Point

**URL:** <https://forum.dynamobim.com/t/set-mtext-attachment-point/59717>\
**Category:** Civil 3D\
**Tags:** share\
**Created:** [January 25, 2021, 9:04pm UTC](https://forum.dynamobim.com/t/set-mtext-attachment-point/59717 "2021-01-25T21:04:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mzjensen](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mzjensen](https://forum.dynamobim.com/u/mzjensen)\
**Post date:** [January 25, 2021, 9:04pm UTC](https://forum.dynamobim.com/t/set-mtext-attachment-point/59717/1 "2021-01-25T21:04:17Z")

</div>

For @dsotelo

Continuing the discussion from [3 MText to 1 MText](https://forum.dynamobim.com/t/3-mtext-to-1-mtext/59533/5):

```
import clr

clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')

from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *

OUT = eval('AttachmentPoint.' + IN[0])

```

 ![AttachmentPoint](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/9/9914dda7d4cc57ab697ade65f4315c5af42ce65f.gif)

---

<div class="post-metadata">

**Author:** ![dsotelo](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@dsotelo](https://forum.dynamobim.com/u/dsotelo)\
**Post date:** [January 25, 2021, 9:15pm UTC](https://forum.dynamobim.com/t/set-mtext-attachment-point/59717/2 "2021-01-25T21:15:45Z")

</div>

Thanks that worked

---

<div class="post-metadata">

**Author:** ![mzjensen](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mzjensen](https://forum.dynamobim.com/u/mzjensen)\
**Post date:** [January 25, 2021, 9:59pm UTC](https://forum.dynamobim.com/t/set-mtext-attachment-point/59717/3 "2021-01-25T21:59:22Z")

</div>

The AttachmentPoint enumeration members are here:

[https://help.autodesk.com/view/OARX/2020/ENU/?guid=OARX-ManagedRefGuide-Autodesk\_AutoCAD\_DatabaseServices\_AttachmentPoint](https://help.autodesk.com/view/OARX/2020/ENU/?guid=OARX-ManagedRefGuide-Autodesk_AutoCAD_DatabaseServices_AttachmentPoint)

---

<div class="post-metadata">

**Author:** ![dsotelo](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@dsotelo](https://forum.dynamobim.com/u/dsotelo)\
**Post date:** [January 25, 2021, 10:51pm UTC](https://forum.dynamobim.com/t/set-mtext-attachment-point/59717/4 "2021-01-25T22:51:24Z")

</div>

Do you know how to make a new line in the mtext using the API? Similar to typing text and hitting enter for a new line of text.

Thank you for your help

---

<div class="post-metadata">

**Author:** ![mzjensen](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mzjensen](https://forum.dynamobim.com/u/mzjensen)\
**Post date:** [January 25, 2021, 11:09pm UTC](https://forum.dynamobim.com/t/set-mtext-attachment-point/59717/5 "2021-01-25T23:09:00Z")

</div>

You can use the \n escape character.

---

<div class="post-metadata">

**Author:** ![dsotelo](https://avatars.discourse-cdn.com/v4/letter/d/ecc23a/32.png) [@dsotelo](https://forum.dynamobim.com/u/dsotelo)\
**Post date:** [January 25, 2021, 11:37pm UTC](https://forum.dynamobim.com/t/set-mtext-attachment-point/59717/6 "2021-01-25T23:37:32Z")

</div>

I tried that and i didnt work.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/9/493890dc1686fc728ea9324cb5d152c0739733db.png)

---

<div class="post-metadata">

**Author:** ![mzjensen](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mzjensen](https://forum.dynamobim.com/u/mzjensen)\
**Post date:** [January 26, 2021, 12:11am UTC](https://forum.dynamobim.com/t/set-mtext-attachment-point/59717/7 "2021-01-26T00:11:17Z")

</div>

It’s not clear what isn’t working in the screenshot.

---

<div class="post-metadata">

**Author:** ![josmer](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@josmer](https://forum.dynamobim.com/u/josmer)\
**Post date:** [May 15, 2023, 9:49pm UTC](https://forum.dynamobim.com/t/set-mtext-attachment-point/59717/8 "2023-05-15T21:49:37Z")

</div>

Hello @zachri.jensen,

Thanks for this code. However, it appears in Python3 this only returns the enum numerical value and not the AttachmentPoint object. I would prefer to update the code for Python3. Do you have any thoughts or knowledge of this? I tried using the migration feature but it says there is an error for “eval(‘AttachmentPoint.’ + IN[0])”.

---

<div class="post-metadata">

**Author:** ![mzjensen](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mzjensen](https://forum.dynamobim.com/u/mzjensen)\
**Post date:** [May 15, 2023, 11:11pm UTC](https://forum.dynamobim.com/t/set-mtext-attachment-point/59717/9 "2023-05-15T23:11:48Z")

</div>

`Python.NET` is funky when handling enums, so that code posted earlier probably won’t work. You’ll have to just do all the work within the Python node itself instead of outputting the enum and then using the _ObjectExtensions.SetParameterValueByName_ node. Start a transaction, open the MText object for write, set the attachment point property, commit the transaction, etc.
