Hi all, Im trying to make a graph to make a certain design option of a designoption set primary. I tried this by using the orchid nodes for getting the design option set and design option. then applying this into a python script. It got me an error, could anyone help?
This is the python script:
# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
# Load the Revit API and RevitServices
clr.AddReference("RevitAPI")
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
# Import the Revit API
import Autodesk
from Autodesk.Revit.DB import *
# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
# Place your code below this line
# Function to set the primary design option
def set_primary_design_option(option_set, option):
try:
option_set.SetPrimary(option)
return True
except:
return False
# Get the active Revit document from the input
doc = IN[0]
# Get the DesignOptionSet and DesignOption IDs from the inputs
option_set_id = IN[1]
option_id = IN[2]
# Find the DesignOptionSet and DesignOption by their IDs
option_sets = FilteredElementCollector(doc).OfClass(DesignOptionSet).ToElements()
option_set = [x for x in option_sets if x.Id == option_set_id][0]
options = option_set.GetDesignOptions()
option = [x for x in options if x.Id == option_id][0]
# Set the primary design option
result = set_primary_design_option(option_set, option.Id)
# Assign your output to the OUT variable.
OUT = result