How to collect elements from links visible on a view in the host model?

Hi @Nikolay_Gerasimov1 ,

here’s a way to do that :

import clr

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

linkdoc = IN[0]
category = IN[1]
if isinstance(IN[2],list):
	views = IN[2]
else:
	views = [IN[2]]
result = []
filter = ElementCategoryFilter(System.Enum.ToObject(BuiltInCategory,category.Id))
ids = [v.Id for v in views]
idlist = [ElementId(i) for i in ids]
for i in idlist:
	result.append(FilteredElementCollector(linkdoc,i).WherePasses(filter).WhereElementIsNotElementType().ToElements())
OUT = result
3 Likes