# GeometryColor.ByGeometryColor recognizes the elements but don't change the color properly

**URL:** <https://forum.dynamobim.com/t/geometrycolor-bygeometrycolor-recognizes-the-elements-but-dont-change-the-color-properly/100600>\
**Category:** Dynamo Player\
**Tags:** geometry, dynamo, color\
**Created:** [May 1, 2024, 11:37am UTC](https://forum.dynamobim.com/t/geometrycolor-bygeometrycolor-recognizes-the-elements-but-dont-change-the-color-properly/100600 "2024-05-01T11:37:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bri47744](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@bri47744](https://forum.dynamobim.com/u/bri47744)\
**Post date:** [May 1, 2024, 11:37am UTC](https://forum.dynamobim.com/t/geometrycolor-bygeometrycolor-recognizes-the-elements-but-dont-change-the-color-properly/100600/1 "2024-05-01T11:37:18Z")

</div>

hi!  
I’m trying to change the color of some surfaces based on a parameter. The function works correctly and recognizes the cylinders but does not change the color and shows me an error color.  
How can I solve this problem?

 ![ask2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/c/8cc5fa062a71360707cf1ab17b449a07acad1bc3.png)  
 ![elements](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/d/fd23de431864fc984e3ef6b5f8150ab1cefc860e.png)

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [May 1, 2024, 12:03pm UTC](https://forum.dynamobim.com/t/geometrycolor-bygeometrycolor-recognizes-the-elements-but-dont-change-the-color-properly/100600/2 "2024-05-01T12:03:20Z")

</div>

This node doesn’t change the color in Revit but in the Dynamo background preview. You want either to set the material, or override the color in the view.

---

<div class="post-metadata">

**Author:** ![bri47744](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@bri47744](https://forum.dynamobim.com/u/bri47744)\
**Post date:** [May 1, 2024, 1:54pm UTC](https://forum.dynamobim.com/t/geometrycolor-bygeometrycolor-recognizes-the-elements-but-dont-change-the-color-properly/100600/3 "2024-05-01T13:54:58Z")

</div>

I was trying this way because I’ve already tried to overriding color and changing material but without success.  
I need to change color in every view where the element appear and every project where I load the family, Element.OverrideColorInView gives me this error “View does not belong to a project document.”  
So, as you suggest, I pass to change material but I can’t find a way to do it, no block to set material only to read it as Element.GetMaterials. And it’s not a parameter, from Element.Parameters-watch there’s no material on the list, so I can’t find it to change with Element.SetParameterByName

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [May 1, 2024, 2:15pm UTC](https://forum.dynamobim.com/t/geometrycolor-bygeometrycolor-recognizes-the-elements-but-dont-change-the-color-properly/100600/4 "2024-05-01T14:15:56Z")

</div>

Edit the family and set the material to be a parameter. Load it into the projects. Then set the parameter as desired.
