Get Host from doortag

Hello,

i use LookUp but i can`t find the error, how can i access the host from my tag ?

KR

Andreas

hosts = []

for i in elements:
	t = GetTaggedReference.Reference(i)
	hosts.append(t)

OUT = hosts

What version of Revit? That method was replaced in 2022.
GetTaggedReference Method (revitapidocs.com)

Your syntax also doesn’t look right in this application. It should be i.GetTaggedReferences().

1 Like

@Nick_Boyts ,

there is a small recomendation


grafik

i will later make a Element or ElementIds



elements = UnwrapElement(IN[0])



hosts = []

for i in elements:
	t = i.GetTaggedReferences()
	hosts.append(t)

OUT = hosts

KR

Andreas

1 Like

@Nick_Boyts

i still stuck regarding dealing with reference
grafik
hmmm :face_with_monocle:

KR

Andreas

The warning tells you exactly what’s going on and your previous output confirms it. GetTaggedReferences() now returns a list so you have to go one step deeper to interact with each reference.

@Nick_Boyts .

i use Revit 2022… so i can use Reference.

or i can go straigt forward in the list…

KR

Andreas

Your code shows that you’re using References though. And the error still confirms that you have a list of lists.

1 Like

@Nick_Boyts ,

its fine so elementid is not Id and is not a string, i tricksed a bit :wink:

door_tags = FilteredElementCollector(doc, doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_DoorTags).WhereElementIsNotElementType().ToElements()

references = []

for i in door_tags:
	references.append(i.GetTaggedReference())
	
elements = [i.ElementId for i in references]

ids = [int(str(i)) for i in elements]

OUT = ids