MATERIALS-Create-from-Excel_MH.dyn (21.1 KB)
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
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
names = IN
for mat_name in names:
new_mat_id = Material.Create(doc, mat_name)
new_mat = doc.GetElement(new_mat_id)
OUT = newMaterialsRevit Dynamo test1.xlsx (18.9 KB)