# Cast Element to Tag

**URL:** <https://forum.dynamobim.com/t/cast-element-to-tag/29196>\
**Category:** Developers\
**Created:** [December 3, 2018, 7:18am UTC](https://forum.dynamobim.com/t/cast-element-to-tag/29196 "2018-12-03T07:18:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul.Storm](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@Paul.Storm](https://forum.dynamobim.com/u/Paul.Storm)\
**Post date:** [December 3, 2018, 7:18am UTC](https://forum.dynamobim.com/t/cast-element-to-tag/29196/1 "2018-12-03T07:18:18Z")

</div>

Can anyone help in how to change the output of my python node so that Tags are recognized in Dynamo. Currently i am only outputting Elements.

 ![1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/f/2f76561a128342bd8800214577cd71646f2427a0.png) ![2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/5/85a8f53372d097b9de4a2ef3d07d0395844c2967.png)

---

<div class="post-metadata">

**Author:** ![lucamanzoni](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/lucamanzoni/32/56718_2.png) [@lucamanzoni](https://forum.dynamobim.com/u/lucamanzoni)\
**Post date:** [December 3, 2018, 9:24am UTC](https://forum.dynamobim.com/t/cast-element-to-tag/29196/2 "2018-12-03T09:24:50Z")

</div>

Actually the node works with Elements, if you select a tag in the model and connect it to the node, it works.

It’s hard to say what is the problem if we don’t see the inputs, can you maybe post a full screenshots, with all previews visible, of a very simplified case?

Also it’s better to post the python code with copy/paste, select it and click on Preformatted Text button 😉

---

<div class="post-metadata">

**Author:** ![Paul.Storm](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@Paul.Storm](https://forum.dynamobim.com/u/Paul.Storm)\
**Post date:** [December 3, 2018, 9:58am UTC](https://forum.dynamobim.com/t/cast-element-to-tag/29196/3 "2018-12-03T09:58:59Z")

</div>

Hi Lucam, I tried a test on a clean project just now. The node does not seem to work for Room Tags. My question is how to set a spatial tag (room tag) elbow etc using Python. Is there a “Set” method for, say, the elbow of a leader (see attached from API)? How would the syntax look in Python?  
Kind Regards,  
Paul

 ![3](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/b/bbf11e37f8c733f40169ff847daf065192a0b2f7.png)

---

<div class="post-metadata">

**Author:** ![lucamanzoni](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/lucamanzoni/32/56718_2.png) [@lucamanzoni](https://forum.dynamobim.com/u/lucamanzoni)\
**Post date:** [December 3, 2018, 10:29am UTC](https://forum.dynamobim.com/t/cast-element-to-tag/29196/4 "2018-12-03T10:29:16Z")

</div>

Yes you are right, I did a test on a wall tag and it was working.

If you want to get the location of the room tag, in Python it should be like this:

```
tag = UnwrapElement(IN[0])
loc = tag.Location.Point.ToPoint()

```

About setting a spatial tag elbow, at the moment I have no idea. May I ask why would you need to do it for a room tag? Maybe there is a workaround

---

<div class="post-metadata">

**Author:** ![Paul.Storm](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@Paul.Storm](https://forum.dynamobim.com/u/Paul.Storm)\
**Post date:** [December 3, 2018, 3:38pm UTC](https://forum.dynamobim.com/t/cast-element-to-tag/29196/5 "2018-12-03T15:38:50Z")

</div>

Hi Luca,  
Thanks for yout time and help. I am also able to “get” the location, but it is the “set” location that is defeating me. It should operate as  
Location.Move  
It is purely a matter of switching out types of tags based on information within the space, and then the leader is no longer horizontal, and I would like to adjust this. It is in response to existing views that must conform to a company standard. I am thinking that the workaround would be to delete the tag and place it again? One does seem to have some control of the elements on creation.  
Kind Regards,  
Paul Storm ![4](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/5/55ebd144951b508e85f653568b69778a58b8ebb5.png)

---

<div class="post-metadata">

**Author:** ![lucamanzoni](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/lucamanzoni/32/56718_2.png) [@lucamanzoni](https://forum.dynamobim.com/u/lucamanzoni)\
**Post date:** [December 3, 2018, 4:07pm UTC](https://forum.dynamobim.com/t/cast-element-to-tag/29196/6 "2018-12-03T16:07:45Z")

</div>

Ok, I see. I showed the way to get the location because in your topic you had problem with the node to get the tag postion.  
To move the tag you need a XYZ that is representing the translation vector.  
This is an example how to move the tag with a vector (1,1,0).

```
tag = UnwrapElement(IN[0])
vector = XYZ(1,1,0)

TransactionManager.Instance.EnsureInTransaction(doc)

loc = tag.Location.Move(vector)

TransactionManager.Instance.TransactionTaskDone()

```

Instead of (1,1,0) you need to find the vector between your current point and the final point

---

<div class="post-metadata">

**Author:** ![Paul.Storm](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@Paul.Storm](https://forum.dynamobim.com/u/Paul.Storm)\
**Post date:** [December 3, 2018, 5:37pm UTC](https://forum.dynamobim.com/t/cast-element-to-tag/29196/7 "2018-12-03T17:37:04Z")

</div>

Hi Luca,  
Perfect. I discovered the Tag.LeaderEnd also works. I will look at controlling the tag further tomorrow, and thank you very much for all your input (it is very much appreciated). 😀  
Kind Regards,  
Paul Storm  
 ![6](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/7/3711f172aa154369c88f7f40007c6d2f3c2a2a65.png)
