Family Editor: Set yes/no parameters for all Types

Hi All,

I’m trying to set some Yes/No Parameters for all types in the family editor but just the current type gets changed.

Any idea why?

This is the code:

import clr

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

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

doc = DocumentManager.Instance.CurrentDBDocument

mgr = doc.FamilyManager

TransactionManager.Instance.EnsureInTransaction(doc)


Types=list(mgr.Types)

_Parameters=FamilyManager.GetParameters(mgr)

for i in Types:
	for j in _Parameters:
		FamilyManager.Set(mgr,j, 0)		
		

TransactionManager.Instance.TransactionTaskDone()

OUT=0

Did you make sure that all parameters were booleans?

Yes they are. It works just for the current type. I need to manually switch type if I want to run the script to the next one.

"FamilyManager.Set is used to set the value of a parameter for the current family type"
From this page:

1 Like

Now you just need to add a line to set the current type for every type in the family.
http://www.revitapidocs.com/2018/3d37cd81-48ba-4011-82bc-dbb7ae14b270.htm

Try setting each type to current before setting params.
Looks like you are iterating over types but not doing anything with them:

for i in Types
    doc.FamilyManager.CurrentType = i 
        for... # iterate and set param values
3 Likes

Thanks!

1 Like