Set parameter of multiple family types in .RFA-file with python

hi @staffan.gustafssonTY

add this line:
famMan.CurrentType = familyType

before this line:

famMan.Set(familyParam, IN[1] + familyType.AsString(familyParam))

your code becomes:

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

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

doc = DocumentManager.Instance.CurrentDBDocument

param_values = list()
types = doc.FamilyManager.Types
famMan = doc.FamilyManager

TransactionManager.Instance.EnsureInTransaction(doc)

familyTypesItor = famMan.Types.ForwardIterator()
familyTypesItor.Reset()

while (familyTypesItor.MoveNext()):
    familyType = familyTypesItor.Current
    familyParam = famMan.get_Parameter(IN[0])
    param_values.append(familyType.AsString(familyParam))
    famMan.CurrentType = familyType
    famMan.Set(familyParam, IN[1] + familyType.AsString(familyParam))


TransactionManager.Instance.TransactionTaskDone()

OUT = param_values

-biboy

4 Likes