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
Hello guys ,
You’ll need to use FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RvtLinks)
And after that how can i get the elements of a specific link
I dont know how firm you are to C# but take a look at this blog:
What is the name of this package
Bakery and Steam nodes
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?
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
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.
Good to know