Elements from linked file

How can you select all elements of category in linked file?

2 Likes

Hi, existing threads like this could help to get started:

use python and modify Built in category inside;

Preformatted textimport clr
clr.AddReference(‚ÄėProtoGeometry‚Äô)
from Autodesk.DesignScript.Geometry import *

Import ToDSType(bool) extension method

clr.AddReference(‚ÄúRevitNodes‚ÄĚ)
import Revit
clr.ImportExtensions(Revit.Elements)

Import geometry conversion extension methods

clr.ImportExtensions(Revit.GeometryConversion)

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 RevitAPI

clr.AddReference(‚ÄúRevitAPI‚ÄĚ)
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference(‚ÄėDSCoreNodes‚Äô)
import DSCore
from DSCore.List import *

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

lnks = FilteredElementCollector(doc).OfClass(RevitLinkInstance)

out =

for i in lnks:
doclnk = i.GetLinkDocument()
coll = FilteredElementCollector(doclnk).OfCategory(BuiltInCategory.OST_StructuralColumns).WhereElementIsNotElementType().ToElements()

out.append(coll)

Start Transaction

TransactionManager.Instance.EnsureInTransaction(doc)

#End the Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = out

3 Likes

Hi @Kjell_Vidar_Andersen
there are nodes in Archi-Lab package to do exactly that :

6 Likes

That worked, thanks :slight_smile:

What that ‚ÄúCode Block‚ÄĚ in the middle does?

1 Like

Thanks.

Weighing in after two years:
result =
for doc in _linkDoc:
result.append(…

This will basically ‚Äėloop‚Äô through all linked models in a list that you want to feed to it. The Archilab Get Documents node will do nicely, with a list.clean on the Link Doc output.

Question: how do I get the family instances from this? I only get the basic classes as a result (I deleted the filter in my version)