Get linked elements how?

hello,

so i get my links and names but finaly i can`t call the elements… where do i stuck

#Template 
#DraxlA
#19.07.2023
import clr
import sys 

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

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

#links
all_docs = app.Documents

names = [d.Title for d in all_docs]

link_doc = all_docs(IN[0])

#collector
collector = FilteredElementCollector(link_doc).OfCategory(BuiltInCategory.OST_Walls)
all_walls = collector.WhereElementIsNotElementType().ToElements()



OUT = ,all_walls

i can`t indexing it

KR

Andreas

It looks as if you have a DocumentSet, which is an IEnumerable Revit class, but is not a Python List. Convert the object to a list via a means such as this: allDocs = [d for d in app.Documents]

1 Like

@jacob.small ,

it works right now !

is there a way to ask the element like “IsLinkedElement” ?

KR

Andreas

Not sure what you mean… but the elements themselves will have a bunch of things you can do with them based on what type of element they are. So best to take one element out of that list and find out what you can do with it.

OUT = dir(all_walls[0])

1 Like