I currently have several views in my print file that have linked views, how can i get a list of the views that have linked view on and also a list of the views being linked?
this can be a hint
Hi @lekan.aboderin and welcome
This method, it’s only available since Revit API 2024 with RevitLinkGraphicsSettings Class
import clr
import sys
import System
#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
#import net library
from System import Array
from System.Collections.Generic import List, IList, Dictionary
#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
typedClasses = List[System.Type]()
typedClasses.Add(DB.RevitLinkType)
typedClasses.Add(DB.RevitLinkInstance)
multiClassFilter = ElementMulticlassFilter(typedClasses)
all_rvtlink_ids = FilteredElementCollector(doc).WherePasses(multiClassFilter).ToElementIds()
#Preparing input from dynamo to revit
filterI = System.Predicate[System.Object](
lambda v : any(v.GetLinkOverrides(xId) is not None \
and v.GetLinkOverrides(xId).LinkedViewId != ElementId.InvalidElementId for xId in all_rvtlink_ids)
)
all_Views_with_linked = List[Element](FilteredElementCollector(doc).OfClass(DB.View)).FindAll(filterI)
OUT = all_Views_with_linked
Please read the forum rules (How to get help on the Dynamo forums ) and the community guidelines (https://forum.dynamobim.com/faq )
2 Likes