Revit link elements


#1

Hello guys ,
By this line i can get the current document " documentmanager.instance.currentdbdocument"
So i can pass this to filteredelementcollector so i can get elements of specific category of the current document , but how can i reach to revit link document so i can get elements of the link


#2

Hi @eng.elfeky,

You’ll need to use FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RvtLinks)


#3

And after that how can i get the elements of a specific link


#4

I dont know how firm you are to C# but take a look at this blog:
https://thebuildingcoder.typepad.com/blog/2013/09/access-to-individual-elements-in-linked-projects.html.


#5

There are some existing nodes that might help too


#6

Thank you


#7

What is the name of this package


#8

Bakery and Steam nodes


#9

Thank you


#10

hello again ,
i tried this nodes and it worked but can i get elements from a specific link if i have many links? or is there any way to do that?


#11

from a list of objects you can select one of the objects like this


The first code block is making a list of 26 items, the second selects number 17 out of the list


#12

If you’d like to do this in Python without any 3rd party nodes, you can use the following:

import clr
clr.AddReference("RevitAPI")
clr.AddReference("RevitServices")

from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager

current_doc = DocumentManager.Instance.CurrentDBDocument
links = FilteredElementCollector(current_doc).OfClass(RevitLinkInstance)

docs = [link.GetLinkDocument() for link in links]

OUT = docs

This will get all Revit link instances in from the current document and return all documents associated with the link instances. You can also append current_doc to the docs list if you want to evaluate elements from both the host document and the linked documents.

You can then pass all of these documents to the FilteredElementCollector() as you would with any other document. So, if you’ve already written a script that uses the FilteredElementCollector you won’t have to change much.


Warnings from linked models
#13

Good to know