Hi - I’m attempting to change all object styles (GraphicsStyle) in a project to have the same material. This is part of a graph that overrides consultant models to be of one solid colour.
I can collect all Graphics Styles using Python but I can’t find how to set their material parameter. Can this be done?
gstyles = FilteredElementCollector(doc).OfClass(GraphicsStyle).ToElements()
mat = UnwrapElement(IN[1])
You do not set it on an Object Style object, you set it on a category. These objects just read that property.
I had a problem where i needed to remove all materials from object style (for IFC export to work correctly) and this is the code snippet.
cats=list(doc.Settings.Categories)
exit=[]
TransactionManager.Instance.EnsureInTransaction(doc)
for i in cats:
catType=i.CategoryType
isModelCat=catType== CategoryType.Model
if isModelCat:
if i.Material != None:
i.Material=None
exit.append(i)
TransactionManager.Instance.TransactionTaskDone()