How to get All Annotation Elements In Active View - section marks, elevation tags etc

@mscottM6C4C Oops, sorry I hadn’t tested for those elements when I suggested that node… Funny I was just about to post a Python script I wrote because I couldn’t find anything that would do what you were asking on this post and I was curious enough: Use dynamo to find all "Referring Views" - trying to reference all annotation symbols that generates a particular view

The script for that turned out to be easily modifiable to collect elevation markers along with view items like elevations and sections:

Python script:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

views = UnwrapElement(IN[0])
if not isinstance(views,list):
	views = [views]

def getRefs(sheetviews):
	elevMarks = []
	viewers = []
	for view in sheetviews:
		elevMarks.append(FilteredElementCollector(doc, view.Id).OfClass(ElevationMarker).ToElements())
		viewers.append(FilteredElementCollector(doc, view.Id).OfCategory(BuiltInCategory.OST_Viewers).ToElements())
	return elevMarks, viewers
	

OUT = getRefs(views)

Let me know if that works as you expect

5 Likes