Hey,
I encountered an issue while trying to override elements graphics in specified view with python.
The OverrideGrapicSettings is created by dynamo node OverrideGraphicSettings.ByProperties (easier to maintain large amount of overrides and editable for non python friendly users). While pushed in to python code, whether wrapped or unwrapped, it creates a following warning:
*Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. *
Traceback (most recent call last):
- File “”, line 34, in *
TypeError: expected OverrideGraphicSettings, got OverrideGraphicSettings
From existing posts, I saw users having similar issues, and ending up creating the OverrideGraphicSettings in code. I would like to avoid that. Is there a way to make the 2 work?
A screen and code used in the workflow is attached.
Thanks for the help
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Load RevitAPI library
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
# Load Libraries to access Revit Document and open Transactions
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Get Current Revit Document
doc = DocumentManager.Instance.CurrentDBDocument
# Open Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
view = UnwrapElement(IN[0])
overrideList = UnwrapElement(IN[1])
elementList = UnwrapElement(IN[2])
checkList = []
for override,element in zip(overrideList, elementList):
#try:
view.SetElementOverrides(element.Id, override)
checkList.Add(Element)
#except:
#checkList.Add("Override Failed")
TransactionManager.Instance.TransactionTaskDone()
OUT = checkList