We have a Dynamo Script to extract values for a door type parameter from an excel file and update the door parameter in the model. We use a python node for updating the model. The below script works for the Built in parameter for the the Construction Type parameter. What would I need to change if I were to reference a shared parameter for doors called ‘Frame_Head’?
import clr
clr.AddReference(‘RevitServices’)
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
from System.Collections.Generic import List
clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.Elements)
def tolist(x):
if hasattr(x,‘iter’): return x
else : return
def getIndex(list, item):
i = 0
for s in list:
if s == item:
break
else:
i += 1
return i
doors = tolist(UnwrapElement(IN[0]))
marks = tolist(UnwrapElement(IN[1]))
check =
doorFilter = ListElement
with Transaction(doc) as t:
t.Start("Changing Keynote Value")
for c in doors:
for a in doorFilter:
if Element.Name.GetValue(a) == c:
b = []
b.append(Element.Name.GetValue(a))
b.append(a.get_Parameter(BuiltInParameter.DOOR_CONSTRUCTION_TYPE).AsString())
f = getIndex(doors, Element.Name.GetValue(a))
a.get_Parameter(BuiltInParameter.DOOR_CONSTRUCTION_TYPE).Set(marks[f].ToString())
b.append(a.get_Parameter(BuiltInParameter.DOOR_CONSTRUCTION_TYPE).AsString())
check.append(b)
t.Commit()
OUT = check