Get Key Schedule parameter values from link files

Hi,
i’m looking to get parameter values for rooms that are in link files. Those parameters are from a key schedule.
Any idea is more then welcome :slight_smile:

Here’s a small sample: Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.

1 Like

check package bimorphNodes :slight_smile:

1 Like

I’m after the Key Name value from a link file

OOTB nodes work on the current document, but you can bust up the string representation of the parameters if you are only looking to get the value.

3 Likes

Similar solution (getting the string representation of the parameter value)

import clr
import sys
import System

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

#import net library
from System import Array
from System.Collections.Generic import List, IList, Dictionary

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument


def funcEval(elem):
	return [elem.LookupParameter(para).AsValueString() for para in lstPara]

def recurseParaValue(lst, i = 0):
	global funcEval
	newlst = list(lst)[:]
	if i < 20000: # prevent infinite loop
		for idx, elem in enumerate(lst):
			if is_iterable(elem) and len(elem) > 0:
				newlst[idx] = recurseParaValue(lst[idx], i+1)
			else:
				print(elem)
				newlst[idx] = funcEval(lst[idx])
	return newlst

is_iterable = lambda x : isinstance(x, list) or x.GetType().GetInterface("IEnumerable") is not None
toList = lambda x : x if is_iterable(x) else [x]

lstRoom = toList(UnwrapElement(IN[0]))
lstPara = toList(IN[1])

OUT = recurseParaValue(lstRoom)
4 Likes