Get view in which a Generic Annotation is placed

Since Generic Annotations are view-specific, is there a way to get the view of a GA in Dynamo (whether that be the view’s name, its ID#, or some other identifier)? There is no property for “View Name” in the list of parameters as shown in the image below (the selected object is a Generic Annotation), and the “View ID” property is a manual one I built into the family as a filter parameter.
I am using Dynamo 2.3.1 in Revit 2020.


Check the element’s workset parameter. (Assuming you are in a workshared file :slight_smile:)

I am not in a workshared file. Is it still possible?
I’ll keep this in mind for workshared files though :grinning:

First up, a plug for my personal preference on Worksharing…Generally speaking I recommend all files are workshared, even if you don’t need Worksharing. It allows better document recovery and opens other benefits. Only reason not to is if you’re using LT which would mean no API which would mean no Dynamo which would make this question moot.

Now with that out of the way, this property is what you are after. Note that you may get odd results with some elements (is dependent views and such), but typically it should get what you need. OwnerViewId Property


Noted. I’ve had my reasons for not making my files workshared but you make a good argument, I’ll consider it for future projects.
And thanks for the info about the property. I will see if it cooperates.

No workset needed.

import clr
import sys


import RevitServices
from RevitServices.Persistence import DocumentManager 

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument

myData = UnwrapElement(IN[0])
mySelection = uidoc.Selection.GetElementIds()
myElements = []
myHost = []

for elem in mySelection:

for e in myElements:
	myHostView = e.OwnerViewId
	myView = doc.GetElement(myHostView)
	myHost.append([e, myHostView, myView])
myResult = myHost

There’s also nodes under Clockwork and Archilab for it.