Hi,
I’m trying to work on a Python Script that takes in a bunch of Family Types, Type Parameters and Values and set their values within the Project Environment.
I’m able to set System Family Parameters but I’m having troubles with loadable family types. To start off with, I’m unable to even get the Parameter values, as get_Parameter() is giving me errors. I should be able to cycle through the Parameters within the selected Family Type and get the values but I’m missing something. Then I should be able to use the element.Set(Value) I woud think?
current code below:
python_set_param.py (1.7 KB)
Or Below in odd Forum Format… Not sure where “CodeBlock” format went to?
import clr
import sys
Import RevitAPI
clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
Import RevitAPIUI
clr.AddReference(‘RevitAPIUI’)
Import DocumentManager and TransactionManager
clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
Import Dynamo Python References
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
Import RevitNodes
clr.AddReference(‘RevitNodes’)
Assign Labels to Revit Document and Application
doc = DocumentManager.Instance.CurrentDBDocument
app = DocumentManager.Instance.CurrentUIApplication.Application
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
famType = IN[0]
param = IN[1]
val = IN[2]
outTC =
builtInParmTM = BuiltInParameter.ALL_MODEL_TYPE_MARK
builtInParmComm = BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS
#TransactionManager.Instance.EnsureInTransaction(doc)
Cycle through all Family Element Types
for i in famType:
# Cycle through All Type Parameters from Family Type
for params in i.Parameters:
#Get BuiltInParameter Values
comments = i.get_Parameter(builtInParmComm)
typeMark = i.get_Parameter(builtInParmTM)
outTC.append(typeMark.AsString())
if param.IsShared and param.Definition.Name == param[1]:
paramVal = i.get_Parameter(param.GUID)
outTC.append(paramVal.AsString())
#Set BuiltInParameter Values
#typeMark = c.Set(val)
#TransactionManager.Instance.TransactionTaskDone()
OUT = outTC