RevitApi

Hi Everyone,
I am trying to update the values for Air terminals. I am getting an error at line 68, expected string but got a type. I am trying to resolve this and Meanwhile any help from anyone would be highly appreciated.

Thank you
Regards,
Chandu

I’d sort the list structure as such instead…

# Boilerplate text
import clr

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager 
from RevitServices.Transactions import TransactionManager 

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

# Current doc/app/ui
doc = DocumentManager.Instance.CurrentDBDocument

# Preparing input from dynamo to revit
rooms  = UnwrapElement(IN[0])
param_names = IN[1]
param_values = IN[2]

room_count = len(rooms)
param_count = len(param_names)

outcomes = []

# Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

for r in range(0,room_count):

	outcomes_sub = []

	for p in range(0,param_count):
	
		try:
			param_get = rooms[r].LookupParameter(param_names[p])
			param_get.Set(param_values[r][p])
			outcomes_sub.append(rooms[r])
		except:
			outcomes_sub.append(None)
	
	outcomes.append(outcomes_sub)

TransactionManager.Instance.TransactionTaskDone()

# Preparing output to Dynamo
OUT = outcomes


Thank you for your reply, Gavin.
Tried your code but got null values as output. Please provide any suggestions on this.
Thank you
Regards,
Chandu

Wokring on my side. Make sure all your parmater values are strings. Also make your element list structure match mine, no sublists, just the elements in one list.

Thanks a lot @GavinCrump

1 Like

I want to update the parameters in the same way, can you share the whole coding?

If you don’t need to rely on python you could use SetParameterByName

https://dictionary.dynamobim.com/#/Revit/Elements/Element/Action/SetParameterByName