Iterating through elements and getting their parameters Revit API

Hello all,

I am trying to basically use the e.GetParameterValueByName in python as opposed to DesignScript. No matter what I read on the API or in the forums I always get the same errors, so I am obviously misunderstanding a step that would make this work.

den = IN[0] #A list of Family Types plugged in via Dynamo
dln = []
for d in den:
	dln.append(d.GetParameters("Parameter Name"))

OUT = dln

However I always get the following error even though I can see in the API that this method exists for elements.

AttributeError: ‘FamilyType’ object has no attribute 'GetParameters

What do I need to do to make this work?

Have you imported the Dynamo RevitNodes library to python? Also, since you’re in an environment which can make API calls directly, I wouldn’t bother using this method and instead use the RevitAPI:

for d in den:
	rawRevitElement = UnwrapElement(d)
	p = rawRevitElement.ParametersMap["Parameter Name"]
	dln.append(p)
4 Likes

I have just read up on and learnt about UnwrapElement() which is crucial to make the code work.

so adding the

den = UnwrapElement(IN[0])
dln = []
for d in den:
	dln.append(d.LookupParameter("EFA FFE Code").AsString())

OUT = dln

makes it work. But thankyou for the excellent hint!