Spot elevations and elements

By altering the code a little bit, you can get a list of reference elements per Spot Dimension you input. Might become handy if you have Spot Dimensions that references more than one element, like a linear dimension :-):

Python:

import clr

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

#Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument

#Start scripting here:
sd = UnwrapElement(IN[0])

elems = []

for i in sd:
	ref = i.References #Get the Spot Dimension reference. Returns a Reference Array
	temp = []
	for j in ref:
		elemid = j.ElementId #Iterate the Reference Array and use the ElementId property to get the ids
		temp.append(doc.GetElement(elemid)) #Use the GetElement() method to get the actual elements
	elems.append(temp)	
	
OUT = elems
6 Likes