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

How to get All Annotation Elements In Active View?

The node, All Elements in Active View does not include annotation elements.

Thanks,
Moses

Clockwork package has a node “All View-Dependent Family Instances Of Category”

2 Likes

It works on text notes in a view but it doesnt work on Elevation Marks or Elevations

@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

Hi @mscottM6C4C

Here is some modification of @awilliams code which will handle lists of views and one view:

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 = []
if isinstance(IN[0],list):
	for i in IN[0]:
		views.append(UnwrapElement(i))
else: 
	views.append(UnwrapElement(IN[0]))


elevMarks, viewers = [], []
for v in views:
	elevMarks.append(FilteredElementCollector(doc,v.Id).OfClass(ElevationMarker).ToElements())
	viewers.append(FilteredElementCollector(doc, v.Id).OfCategory(BuiltInCategory.OST_Viewers).ToElements())
		

OUT = zip(elevMarks, viewers)
5 Likes

Thanks. This works well to get the elevation markers in one list. I could just augment to code to include section marks found in the view?

Thanks very much.

This line here is collecting section views and the elevation pointers: viewers.append(FilteredElementCollector(doc, v.Id).OfCategory(BuiltInCategory.OST_Viewers).ToElements())

Hooking the output of the Python script to an Element.Name node should make this more apparent :slight_smile:

@awilliams & @mscottM6C4C I know this is an old post but I was wondering if it’s possible to get the location (point) of a list of elevation markers. I’ve found other posts that touch on this but I can’t seem to get anything to work. One post addresses how to get one elevation marker which I can get to work but I can’t get the list to work.

Hey- reviving a few years later… Having an issue with the retrieval of the generic annotations from a given view - this one uses a lambda predicate…