In this video I show how to use teh Revit API to select, filter and dleete elevation markers that do not have associated views.
Here is the Python to get the Markers that have no Elevation on them.
# Default imports
import clr
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
doc = DocumentManager.Instance.CurrentDBDocument
app = DocumentManager.Instance.CurrentUIApplication.Application
#The input to this node will be stored in the IN[0] variable and unwrap element
elements = UnwrapElement(IN[0])
#variables
output = []
elemsNotElevation = []
elemsHasElevation = []
#iterate through list and sort
for e in elements:
if e.HasElevations() == False:
elemsNotElevation.append(e)
else:
elemsHasElevation.append(e)
#compile output
output.append(elemsNotElevation)
output.append(elemsHasElevation)
#Assign your output to the OUT variable
OUT = output