# Dynamo script for transferring material color codes into graphic overrides

**URL:** <https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935>\
**Category:** Revit\
**Tags:** revit, dynamo\
**Created:** [July 14, 2026, 11:52am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935 "2026-07-14T11:52:32Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Uenal.Koesedag9GSXG](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@Uenal.Koesedag9GSXG](https://forum.dynamobim.com/u/Uenal.Koesedag9GSXG)\
**Post date:** [July 14, 2026, 11:52am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/1 "2026-07-14T11:52:32Z")

</div>

**Translated by moderator. See below the line for original post.**

* * *

Hello everyone,

I’d like to create a Dynamo script that automatically reads the material color codes of the pipe system types and then applies these colors to the graphical overrides of the line colors. Pipe system types with the same material color code should automatically receive the same line color in the graphical overrides.

The goal is to keep the color definitions consistent and reduce the manual effort required to maintain the graphical representation.

Specifically, the script should: read the material color codes of the pipe system types, determine the corresponding colors, adjust the graphical overrides accordingly, and automatically link identical material color codes with the same line color.

Since I couldn’t do this directly in the script, I tried overriding line colors via Excel.

Kind regards,

Kösedag Ünal

* * *

**Original post below**

* * *

Hallo zusammen,

ich möchte ein Dynamo-Skript erstellen, das die Materialfarbcodes der Rohrsystemtypen automatisch ausliest und diese Farben anschließend in die grafischen Überschreibungen der Linienfarben übernimmt. Dabei sollen Rohrsystemtypen mit demselben Materialfarbcode automatisch die gleiche Linienfarbe in den grafischen Überschreibungen erhalten.

Ziel ist es, die Farbdefinitionen konsistent zu halten und den manuellen Aufwand bei der Pflege der grafischen Darstellung zu reduzieren.

Konkret soll das Skript: die Materialfarbcodes der Rohrsystemtypen auslesen, die zugehörigen Farben ermitteln, die grafischen Überschreibungen entsprechend anpassen, und identische Materialfarbcodes automatisch mit derselben Linienfarbe verknüpfen.

Weil ich nihct direkt im Skript geschafft habe, habe versucht über Excel Linienfarben zu überschreiben.

Freundliche Grüsse

Kösedag Ünal

---

<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:** [July 14, 2026, 1:20pm UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/2 "2026-07-14T13:20:33Z")

</div>

Welcome to the forum @Uenal.Koesedag9GSXG.

Unfortunately the official language here is English (annars skulle jag svara på svenska så att jag kunde öva). Sadly this is a requirement to make search work along with so many other technical things, so please translate all future posts prior to hitting send using the web service of your choice. You’re welcome to keep your native language post on there as well so long as you put a clear divisor between it and the English post as I did in the edit of your original post - doing so can help should we ever get multi-language support in the forum.

---

<div class="post-metadata">

**Author:** ![Uenal.Koesedag9GSXG](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@Uenal.Koesedag9GSXG](https://forum.dynamobim.com/u/Uenal.Koesedag9GSXG)\
**Post date:** [July 15, 2026, 6:48am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/3 "2026-07-15T06:48:04Z")

</div>

Why isn’t it working?

[Grafik duct and pipe systems V2.dyn](https://forum.dynamobim.com/uploads/short-url/1GdViTLqNYQLccXKFMHYAZa7qUA.dyn) (40.5 KB)

 ![Grafik duct and pipe systems from Excel V01_2026-07-15_08-46-13](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/d/3d5edb609681663890e26835ee3d2d86c36f0bc7.png)

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [July 15, 2026, 7:06am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/4 "2026-07-15T07:06:41Z")

</div>

hi @Uenal.Koesedag9GSXG maybe becaurse you try get material from system type, guess you are more after get material from elements on these systemtypes…maybe 😉

---

<div class="post-metadata">

**Author:** ![Uenal.Koesedag9GSXG](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@Uenal.Koesedag9GSXG](https://forum.dynamobim.com/u/Uenal.Koesedag9GSXG)\
**Post date:** [July 15, 2026, 7:28am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/5 "2026-07-15T07:28:13Z")

</div>

@sovitek Thank you very much for your answer. Exactly, I want to get material of a certain system type and override line colors in the same system type. But I can’t figure it out.

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [July 15, 2026, 7:45am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/6 "2026-07-15T07:45:18Z")

</div>

try genius loci there is some nodes for set /get the pure systemtype graphic properties and could probably help if your pipes/ ducts isnt overridden by filter or other things…hope is what you are after…but not 100 😉

 ![Skærmbillede 2026-07-15 094147](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/c/acab6066d4822ddf4c22758c200d0891033844ce.jpeg)

---

<div class="post-metadata">

**Author:** ![Uenal.Koesedag9GSXG](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@Uenal.Koesedag9GSXG](https://forum.dynamobim.com/u/Uenal.Koesedag9GSXG)\
**Post date:** [July 15, 2026, 9:52am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/7 "2026-07-15T09:52:07Z")

</div>

I’ve already tried this solution, and you’re right it doesn’t quite work, unfortunately. Is it possible to solve the problem using a Python script?

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [July 15, 2026, 9:57am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/8 "2026-07-15T09:57:51Z")

</div>

what doesnt work is it get systemtype or get or set graphic…for get the graphic try as here for cpyhon3 or pythonnet 3 and …show us exackly what all you nodes give and can probably help…

```auto
import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference('DSCoreNodes')
import DSCore
from DSCore import Color

elements = UnwrapElement(IN[0]) if isinstance(IN[0], list) else [UnwrapElement(IN[0])]

systype,name,classification,abbreviation,lineWeight,lineColor,linePattern,material,types,category=[],[],[],[],[],[],[],[],[],[]

for elem in elements:
    if isinstance(elem, Autodesk.Revit.DB.ElementType):
        systype.append(elem)
    else:
        system = None
        if elem.get_Parameter(BuiltInParameter.RBS_PIPING_SYSTEM_TYPE_PARAM):
            system = elem.get_Parameter(BuiltInParameter.RBS_PIPING_SYSTEM_TYPE_PARAM).AsElementId()
        elif elem.get_Parameter(BuiltInParameter.RBS_DUCT_SYSTEM_TYPE_PARAM):
            system = elem.get_Parameter(BuiltInParameter.RBS_DUCT_SYSTEM_TYPE_PARAM).AsElementId()
        systype.append(doc.GetElement(system) if system is not None else None)
    category.append(Revit.Elements.Category.ById(elem.Category.Id.Value))

for i in systype:
    if i is not None:
        name.append(i.ToDSType(True).Name)
        classification.append(i.SystemClassification)
        abbreviation.append(i.Abbreviation)
        linePattern.append(doc.GetElement(i.LinePatternId))
        try:
            lineColor.append(DSCore.Color.ByARGB(255, i.LineColor.Red, i.LineColor.Green, i.LineColor.Blue))
        except Exception:
            lineColor.append(None)
        lineWeight.append(i.LineWeight)
        material.append(doc.GetElement(i.MaterialId))
    else:
        name.append(None)
        classification.append(None)
        abbreviation.append(None)
        linePattern.append(None)
        lineColor.append(None)
        lineWeight.append(None)
        material.append(None)

if isinstance(IN[0], list):
    OUT = systype,name,classification,abbreviation,linePattern,lineColor,lineWeight,material,category
else:
    OUT = systype[0],name[0],classification[0],abbreviation[0],linePattern[0],lineColor[0],lineWeight[0],material[0],category[0]

```

and for set graphic genius loci should work for ironpython 2.7 version 2.5 package and direckly with pythonnet 3 , and then you need the pythonnet 3 package 1.0 installed…depends version

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [July 15, 2026, 10:11am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/9 "2026-07-15T10:11:55Z")

</div>

and PS if is pipe system types there struggle then just use ootb instead

 ![Skærmbillede 2026-07-15 121017](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/0/c0a7946077f2953fe42089b4d8eb048089c54ddf.png)

---

<div class="post-metadata">

**Author:** ![Uenal.Koesedag9GSXG](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@Uenal.Koesedag9GSXG](https://forum.dynamobim.com/u/Uenal.Koesedag9GSXG)\
**Post date:** [July 15, 2026, 2:15pm UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/10 "2026-07-15T14:15:58Z")

</div>

@sovitek Thank you so much for your support. I’ve already adjusted the script, but it’s not happening ☹

[Grafik duct and pipe systems V3.dyn](https://forum.dynamobim.com/uploads/short-url/yGoSR1Y9F66nr0FXIvvKqbLsm1i.dyn) (26.3 KB)

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [July 15, 2026, 2:27pm UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/11 "2026-07-15T14:27:44Z")

</div>

allright can you share a small rvt sample..where it doesnt work, and we can take a look…btw which revit version are you in ?

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [July 15, 2026, 2:42pm UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/12 "2026-07-15T14:42:48Z")

</div>

i have just open you graph you still use some custom node for get pipesystemtype use ootb

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/9/f93747caab91b107e1dfe1647a1433eebe8618ef.png)

---

<div class="post-metadata">

**Author:** ![Uenal.Koesedag9GSXG](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@Uenal.Koesedag9GSXG](https://forum.dynamobim.com/u/Uenal.Koesedag9GSXG)\
**Post date:** [July 15, 2026, 10:48pm UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/13 "2026-07-15T22:48:11Z")

</div>

@sovitek Thank you so much for your support. Here are my files. I’m using Revit 2025 and Dynamo 3.3. I’m also attaching a Revit file and Dynamo script via WeTransfer because the file was too large to upload.

[https://we.tl/t-nvx6vbgzxTUij8pf](https://pipe%20system%20type%20graphic%20override%20set%20linecolorfrom%20material.zip)

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [July 16, 2026, 3:46am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/14 "2026-07-16T03:46:15Z")

</div>

alright the link doesnt work

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [July 16, 2026, 6:09am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/15 "2026-07-16T06:09:12Z")

</div>

but it works from my side here with cpython 3 or pythonnet 3…if it doesnt work for you and in your graph, its probably how you sort and do…but i havent goin into that  
[test graphic.dyn](https://forum.dynamobim.com/uploads/short-url/uPUrxFWmkVKJmIhyyobTTgNH9au.dyn) (33.8 KB)

 ![Skærmbillede 2026-07-16 080504](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/9/e9d8f345b47d763195a1580a6cbb4fd65b522caa.png)

---

<div class="post-metadata">

**Author:** ![Uenal.Koesedag9GSXG](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@Uenal.Koesedag9GSXG](https://forum.dynamobim.com/u/Uenal.Koesedag9GSXG)\
**Post date:** [July 16, 2026, 7:21am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/16 "2026-07-16T07:21:18Z")

</div>

@sovitek Hi again, thanks so much for your support. I ran your test script, but the line colors of the pipes, which were supposed to inherit the material colors, didn’t work. I’m sending a link to the Revit file.

> **[HolingerData](https://holingerdata.com/shares/white-sound-still-tooth)**

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [July 16, 2026, 7:32am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/17 "2026-07-16T07:32:29Z")

</div>

i dont wanna by in dyn today, but genius loci should have nodes as well for get material color

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [July 16, 2026, 8:34am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/18 "2026-07-16T08:34:41Z")

</div>

You have a lot of system types with no material assigned—that results in null values. Try cleaning that up… give something like this a try and see if it works better.

 ![Skærmbillede 2026-07-16 103156](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/2/82756cb5134fea2c981236e69735b68921f46821.png)

---

<div class="post-metadata">

**Author:** ![Uenal.Koesedag9GSXG](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@Uenal.Koesedag9GSXG](https://forum.dynamobim.com/u/Uenal.Koesedag9GSXG)\
**Post date:** [July 16, 2026, 9:38am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/19 "2026-07-16T09:38:07Z")

</div>

@sovitek Hi again, thanks so much for your support. I’ve adjusted the script, but the line colors are still the same ☹

 ![test graphic_2026-07-16_11-33-41](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/1/318d81ae264cceba2478ab47c321e89543a5aef6.png)

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [July 16, 2026, 9:53am UTC](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935/20 "2026-07-16T09:53:03Z")

</div>

set lacing to longest maybe

![Revit_9bd5MJkNfo](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/0/30ac76613de9ccc264e20a91dcc91c809c82bc8d.gif)

[Next page](https://forum.dynamobim.com/t/dynamo-script-for-transferring-material-color-codes-into-graphic-overrides/114935.md?page=2)
