Assign Material to all Object Styles

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()

also see this post

1 Like