Retrieve Project Information Parameters for linked elements

Hi everyone.
This is my issue: I am retrieving a list of elements from linked files, and also the list of Link Instances.
What I want to achieve is to get a list of the elements related with a specific parameter from each Link ‘Project Information’ parameters, as seen in the image attached.
Also you can see the code I wrote to get the specified parameter from ‘Project Information’.
Is there a way to relate the elements with this parameters the same way you do it with revit Schedules?

It would be much easier to get the document directly from the element and then the project info from that document.

@Nick_Boyts Is it possible to get the document directly from an element?. It doesn’t seem to be possible if you read into RevitAPI docs.

Give this a try: https://www.revitapidocs.com/2020/9e530d25-61ca-3899-a531-cbcfd994358d.htm

1 Like

@Nick_Boyts Oh I was looking into methods, not properties. That was really easy and finally worked fine for me. So, now I got document from the elements and then ‘Project Information’ so that I was able to iterate over it and get the parameter I was looking for.
Thank you a lot!

Hi David, can you please show us how did you do it. I am trying to do the same thing. Thanks!

Hi @arellan .
Sure. This is the Python code that I used to get that parameter:

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

clr.AddReference('DSCoreNodes')
from DSCore import List

elements = IN[0]

documents = []
for element in elements:
	document = UnwrapElement(element).Document
	documents.append(document)
	
information = []
for docu in documents:
	unwrap = UnwrapElement(docu)
	info = FilteredElementCollector(unwrap).OfCategory(BuiltInCategory.OST_ProjectInformation).ToElements()
	information.append(info)

result = List.Flatten(information, 1)

parameters = []

for res in result:
	try:
		building = UnwrapElement(res).LookupParameter('Building').AsString()
		if building :
			parameters.append(building )
		else: 
			parameters.append('No Information')
	except:
		parameters.append('No Information')

		
OUT = parameters
2 Likes

Thank you so much, David for sharing that! It makes so much sense now.

1 Like