Select annotations by associated revit id of modelled element

Hi @jup ,
for tags there’s a node in the archi-lab package :

for dimensions, I don’t know of any existing node that retrieves the reference elementd. So here’s some code :

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
import sys
pyt_path = r'C:\\Program Files (x86)\\IronPython 2.7\\Lib'
sys.path.append(pyt_path)

doc = DocumentManager.Instance.CurrentDBDocument
def ProcessList(_func, _list):
    return map( lambda x:
    process_list(_func, x) if type(x)==list else _func(x), _list )

def GetDimensionHostElement(dimension):

	hostElemRefs = UnwrapElement(dimension).References
	hostElems = [doc.GetElement(he.ElementId) for he in hostElemRefs]
	return hostElems

try:
	errorReport = None
	output = ProcessList(GetDimensionHostElement, IN[0])
except:
	# if error accurs anywhere in the process catch it
	import traceback
	output = traceback.format_exc()

OUT = output
3 Likes