Jean-Marc Couffin
Jean-Marc Couffin

Reputation: 11

ActiveProjectLocation.Name of Revit links inside Revit links

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.

Image of Dynamo Script

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
  1. Is it possible to get the ActiveProjectLocation.Name of C RevitLinkInstances?
  2. What amount of info can I fetch @ C level without opening the file in background?
  3. Is it an API limitation or just a file data storage limitation?

Upvotes: 1

Views: 809

Answers (1)

Jeremy Tammik
Jeremy Tammik

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:

  • You basically need to get each link as its own document then do a get these revit links from that linked document. I think this post will help you get towards your goal...

I suggest you follow his advice and recursively open each link as a separate document to retrieve the required information from there.

Upvotes: 1

Related Questions