Collect Elements from Linked Files

Hello community!

This is my goal:

  • Create a list of all elements (of a linked model) based on the categories of that model.

I am a beginner in python but here is where I am thanks to @jbenoit44 @Julien_Benoit1 and his custom node “Element.GetFromLinkedFile”.

The main question is: how can I edit this python node so it accepts a list of OST categories?
I found this great post but I don’t know how to connect the dots. Thank you all!

https://forum.dynamobim.com/t/collect-all-categories-in-a-project/6054/30?u=chrisrob

#python nodes in dynamo 1.0
#proposed by Julien Benoit @jbenoit44
#http://aecuandme.wordpress.com/
import clr

Import RevitAPI

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

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)

Import DocumentManager and TransactionManager

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

import Autodesk
import System

clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

Import ToDSType(bool) extension method

Import geometry conversion extension methods

clr.ImportExtensions(Revit.GeometryConversion)

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

LinkDoc=IN[0]
cat = IN[1]
LinkInst = IN[2]

BuiltIn = System.Enum.ToObject(BuiltInCategory, cat.Id)

elementlist =
typelist=
T =

collector = FilteredElementCollector(LinkDoc)
filter = ElementCategoryFilter(BuiltIn)
list=collector.WherePasses(filter).WhereElementIsNotElementType().ToElements()

OUT = list

Solved!

After some trial and error, I found the missing link. I was about to give up! Moral of the story, never give up :joy:

1 Like