Hi everyone,
I am trying to load shared parameter to the project and then bind them to the categories
# Import the required Revit API classes
import clr
clr.AddReference('RevitAPI')
import Autodesk.Revit.DB as DB
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
# Set the path to the shared parameters file
sharedParametersFile = IN[0]
# Load the shared parameters file
defFile = DB.ExternalFileUtils.ToString(sharedParametersFile)
categorySet = DB.ElementIdSet()
categorySet.Insert(DB.ElementId(DB.BuiltInCategory.OST_Walls))
# Create a category set and a definition map
categorySet = DB.ElementIdSet()
categorySet.Insert(DB.ElementId(DB.BuiltInCategory.OST_Walls))
defMap = DB.DefinitionBindingMap()
# Add the shared parameters to the definition map
for defGroup in defFile:
for definition in defGroup.Definitions:
if definition.Name not in defMap:
defMap.Add(definition, categorySet)
# Bind the shared parameters to the categories
doc = Revit.ActiveUIDocument.Document
transaction = DB.Transaction(doc, "Bind Shared Parameters")
transaction.Start()
DB.ParameterBindingService.GetBindingOptions(doc)
DB.ParameterBindingService.OverrideBinding(doc, defMap, DB.BindingPriorityType.Temporary)
transaction.Commit()
Something doesnt seem to work. Could someone help me understand where might be going wrong about the steps.
QIC_Shared_Parameter_File.txt (1.2 KB)
001_PythonBatchProcessing_Parameters.dyn (6.6 KB)