Create material from the excel file

MATERIALS-Create-from-Excel_MH.dyn (21.1 KB)

Hello all,

I am trying to use excel as a material database as we use various software etc so I need a central resource. I want to use Dynamo to add these materials to Revit, and be able to update them. Unfortunately the out of the box nodes are not sufficient so I am trying to use python as well. I am however getting tripped up in one of the first steps.

I can add materials to Revit, but if the script is re run or a materials is added to the list, it will not run as there is already a materia with that name present. Help appreciated!

This is the script

import clr
clr.AddReference(“RevitAPI”)
from Autodesk.Revit.DB import *
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

names = IN[0]

newMaterials =
for mat_name in names:
TransactionManager.Instance.EnsureInTransaction(doc)
new_mat_id = Material.Create(doc, mat_name)
new_mat = doc.GetElement(new_mat_id)
TransactionManager.Instance.TransactionTaskDone()
newMaterials.append(new_mat)

OUT = newMaterialsRevit Dynamo test1.xlsx (18.9 KB)

Hi @minho3.jung,

There are already packages with custom nodes to create and edit materials like for example Genius Loci package.

1 Like

thanks for advoice where can i find Genius Loci package? do you know homapage or wepsite?
if you know some infomation plz reply! or send some massage thanks!

To install a package you have two options :

1 Like

thank for reply!

Thanks For make amazing dynamo package!

But when I use genius loci Create material node is not work …
Please let me know why not working the create material node and what’s wrong.
use verstion : revit 2018 & dynamo 2.0.3.0
Create Material From Excel_Dynamo.dyn (29.2 KB) dynamo-now-MATERIALS-Create-from-Excel.xlsx (40.2 KB)

Hi Jung,

I’m glad you find the package useful.

The custom node use colors and not a list of integers.
Your graph :

Working graph :


Create Material From Excel_Dynamo V2.dyn (27.8 KB)

1 Like

Really Thanks Reply.
this dynamo really help my work .