# Get endpoint of Leader of Independent Tag

**URL:** <https://forum.dynamobim.com/t/get-endpoint-of-leader-of-independent-tag/86243>\
**Category:** Developers\
**Tags:** revit, python, dynamo\
**Created:** [February 16, 2023, 1:30pm UTC](https://forum.dynamobim.com/t/get-endpoint-of-leader-of-independent-tag/86243 "2023-02-16T13:30:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtmiller](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@jtmiller](https://forum.dynamobim.com/u/jtmiller)\
**Post date:** [February 16, 2023, 1:30pm UTC](https://forum.dynamobim.com/t/get-endpoint-of-leader-of-independent-tag/86243/1 "2023-02-16T13:30:26Z")

</div>

I am needing to Get all the leader end points of Tags to Pipes. The pipes being tagged are in a linked model. So Dynamo sees the pipe Tags as Independent tags. The OOTB Nodes for getting the Leader End point do not recognize Independent Tags. I have found Nodes from the Packages MEPover and GeniusLoci that will Get the Host Tag Position. I am hoping it is as easy as updating the code, but I am not familiar with how to find the command for Leader end Instead of TagHostPosition.

```auto
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
if isinstance(IN[0], list):
	tags = UnwrapElement(IN[0])
else:
	tags = [UnwrapElement(IN[0])]
listout = []
for x in tags:
	loc = x.TagHeadPosition.ToPoint()
	listout.append(loc)
OUT = listout

```

Long Story Short, I am trying to move all the Attached pipe tags that are to the center of the pipe, make them free end and move the leader to edge of pipe. I can get this to work when the pipes are not in a linked model and I am tagging from the same model, but when the pipes are in a linked model it will not work because the nodes get errors with Independent Tags instead of them being PipeTags.  
Thanks, sorry for the long post. 🙂

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [February 16, 2023, 2:33pm UTC](https://forum.dynamobim.com/t/get-endpoint-of-leader-of-independent-tag/86243/2 "2023-02-16T14:33:59Z")

</div>

@jtmiller ,

i get a point 😉 BUT i cleaned up your code.

i think its not correct

 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/1/e13e7fede845e7b0fedb4b998d7ce9bfb4916a80.png)

```auto
import sys
import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

if isinstance(IN[0], list):
    tags = UnwrapElement(IN[0])
else:
    tags = [UnwrapElement(IN[0])]
    
listout =[]

for x in tags:
    loc = x.TagHeadPosition.ToPoint()
    listout.append(loc)
    
OUT = listout

```

---

<div class="post-metadata">

**Author:** ![jtmiller](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@jtmiller](https://forum.dynamobim.com/u/jtmiller)\
**Post date:** [February 16, 2023, 2:42pm UTC](https://forum.dynamobim.com/t/get-endpoint-of-leader-of-independent-tag/86243/3 "2023-02-16T14:42:38Z")

</div>

Thank you @Draxl_Andreas for the rewrite. I might have not described my problem incorrectly. I am looking to get the Leader End point instead of the TagHeadPosition. Do you think you could update that? I am not sure what to update TagHeadPosition with.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/7/a77783a129f1d9b281bfcf9858147d1c4fc02e0d.png)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [February 16, 2023, 2:48pm UTC](https://forum.dynamobim.com/t/get-endpoint-of-leader-of-independent-tag/86243/4 "2023-02-16T14:48:25Z")

</div>

@jtmiller ,

seems not to be exposed … hmmm

> **[TagHeadPosition Property](https://www.revitapidocs.com/2022/883ccdc6-9d4e-7844-9f81-e77124f39677.htm)**
>
> Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [February 22, 2023, 7:30pm UTC](https://forum.dynamobim.com/t/get-endpoint-of-leader-of-independent-tag/86243/5 "2023-02-22T19:30:24Z")

</div>

Hello  
a workaround by temporarily setting the LeaderEndCondition to free

![get end leader](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/d/bd7095f4c58ce0cda6f532f1739075d6441e3579.gif)

```auto
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
app = uiapp.Application
sdkNumber = int(app.VersionNumber)

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

def setFreeEnd_temp(func):
	def wrapper(*args, **kwargs):
		tag = args[0]
		TransactionManager.Instance.ForceCloseTransaction()
		t = Transaction(doc, func. __name__ )
		t.Start()
		tag.LeaderEndCondition = LeaderEndCondition.Free
		doc.Regenerate()
		ret = func(*args, **kwargs) 
		t.RollBack()
		t.Dispose()
		return ret 
	return wrapper 

@setFreeEnd_temp
def get_endpoint_of_Tag(tag):
	if sdkNumber < 2022:
		return tag.LeaderEnd.ToPoint()
	else:
		ref = next(e for e in tag.GetTaggedReferences())
		return tag.GetLeaderEnd(ref).ToPoint()

tag = UnwrapElement(IN[0])
OUT = get_endpoint_of_Tag(tag)

```

---

<div class="post-metadata">

**Author:** ![jtmiller](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@jtmiller](https://forum.dynamobim.com/u/jtmiller)\
**Post date:** [February 22, 2023, 10:08pm UTC](https://forum.dynamobim.com/t/get-endpoint-of-leader-of-independent-tag/86243/6 "2023-02-22T22:08:22Z")

</div>

Thank You! I will give this a try and let you know. I seem to have problems when it comes to Python stuff. Is it as simple as copy and paste into the Python Node?

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [February 22, 2023, 10:11pm UTC](https://forum.dynamobim.com/t/get-endpoint-of-leader-of-independent-tag/86243/7 "2023-02-22T22:11:45Z")

</div>

> [@jtmiller](#):
>
> Is it as simple as copy and paste into the Python Node?

it’s an example for 1 element, you just need to adapt the code for an input list
