Reputation: 11
I open file A, which has x files B linked into it. Files B also has x files C linked into it. I want to know the name of the location of files C.
I use dynamo for revit to collect RevitLinkInstances (B) in file A and then the previous RevitLinkInstances (B) to collect their RevitLinkInstances (C). That part works well, can be done with custom nodes or python. From there I can collect any number of Project Information from C RevitLinkInstances(in their saved state when I last opened C RevitLinkInstancesfrom my understanding)
I get everything I want so far from the C RevitLinkInstances without opening them in background: File name, instance name, Pinned status, design option, workset of instance, workset of type.
When I try to collect the ActiveProjectLocation.Name of my C files I get nulls, and when I try to GetDocument() just before, same result. It seems logical if that info is not stored in B RevitLinkInstances.
I used the following python for my C RevitLinkInstances and first describe my issue here https://forum.dynamobim.com/t/get-project-location-name-of-revit-links-in-revit-links-inception-like-question
import clr
# clr.AddReference loads and imports .net assembly(dll) as python module
# load RevitAPI.dll and RevitServices.dll
clr.AddReference("RevitAPI")
clr.AddReference("RevitServices")
# import filtered element collector and revit link instance classes
from Autodesk.Revit.DB import FilteredElementCollector, RevitLinkInstance
# import document manager
from RevitServices.Persistence import DocumentManager
# collect link documents from current document
link_docs = UnwrapElement(IN[0])
#rvtLinks = link_docs.ToElements()
ProjectLocation = []
#Queries
for i in link_docs :
projloc = i.GetLinkDocument().ActiveProjectLocation.Name
#Append Output Lists
ProjectLocation.Add(projloc)
OUT = ProjectLocation
Upvotes: 1
Views: 809
Reputation: 8294
I see that this question was already discussed in depth in the dynamobim forum thread on getting project location name of Revit links in Revit links.
As far as I am aware, Brendan_Cassidy's initial answer in that thread is perfectly accurate:
I suggest you follow his advice and recursively open each link as a separate document to retrieve the required information from there.
Upvotes: 1