Independant Tag / Tagged Object / LookUp

Hello Hello,

In Revit Lookup I can find the tagged object of an independant tag… see the picture

so… is it possible to get to that parameter in dynamo also???

jckh

Hi @Jan_Christoph_Kahre ,

strangely enough there doesnt seem to already be a node for that… Anyway here’s how you can get it:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager


doc = DocumentManager.Instance.CurrentDBDocument

tag = UnwrapElement(IN[0])
id = tag.TaggedLocalElementId
host = doc.GetElement(id)



OUT = host
1 Like

Here’s a better version that works with nested lists

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

def ProcessList(_func, _list):
    return map( lambda x: ProcessList(_func, x) if type(x)==list else _func(x), _list )
def UnwrapNestedList(x):
	return UnwrapElement(x)
def NestedTagHostIds(x):
	return x.TaggedLocalElementId
def NestedElements(i):
	return doc.GetElement(i)

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


ids = ProcessList(NestedTagHostIds,tags)

hosts = ProcessList(NestedElements,(ids))


OUT = hosts

Mostafa_El_Ayoubi !!!

again… that solved it.

Many Thanks

jckh