# Assign Material to all Object Styles

**URL:** https://forum.dynamobim.com/t/assign-material-to-all-object-styles/53504
**Category:** Revit
**Tags:** python
**Created:** [July 29, 2020, 6:16am UTC](https://forum.dynamobim.com/t/assign-material-to-all-object-styles/53504 "2020-07-29T06:16:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Michael\_Dunn1](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael\_Dunn1](https://forum.dynamobim.com/u/Michael_Dunn1)
#### Post date: [July 29, 2020, 6:16am UTC](https://forum.dynamobim.com/t/assign-material-to-all-object-styles/53504/1 "2020-07-29T06:16:44Z")

</div>

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])`

Thank you.

---

<div class="post-metadata">

### Author: ![JBH](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@JBH](https://forum.dynamobim.com/u/JBH)
#### Post date: [October 26, 2020, 5:26am UTC](https://forum.dynamobim.com/t/assign-material-to-all-object-styles/53504/2 "2020-10-26T05:26:47Z")

</div>

Did you find a solution for this? I’m trying to do the same thing with Dynamo.

Love to know either way!  
Thank!

---

<div class="post-metadata">

### Author: ![Michael\_Dunn1](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael\_Dunn1](https://forum.dynamobim.com/u/Michael_Dunn1)
#### Post date: [October 26, 2020, 6:17am UTC](https://forum.dynamobim.com/t/assign-material-to-all-object-styles/53504/3 "2020-10-26T06:17:40Z")

</div>

No solution sorry. Needs someone smarter than me! 🙂

---

<div class="post-metadata">

### Author: ![Andrej.Licanin](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Andrej.Licanin](https://forum.dynamobim.com/u/Andrej.Licanin)
#### Post date: [April 5, 2022, 6:31pm UTC](https://forum.dynamobim.com/t/assign-material-to-all-object-styles/53504/4 "2022-04-05T18:31:36Z")

</div>

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.

```auto
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

> [@Set Material of Category to Null](https://forum.dynamobim.com/t/set-material-of-category-to-null/64763/5):
>
> Yes - but didn’t work.
