Load Materials from Material Library from Dynamo?

Is it possible from Dynamo to load Materials from the Material Library?

Thanks :wink:

Hi Daniel,

Yes it is possible to get materials from the material library. See below screenshot and also you can set material using “Element.setMaterialParameterByCategory” node from Clockwork Package.



Did you by any chance mean loading materials into a Project Material Library from an External Material Library?

If that was your question, I am afraid there are no API methods exposed currently to do that. I found out that some people would create an Excel based material library with all of the properties needed to create a material and then instead of loading materials in they would create a new set of them in the project based on that Excel document. That is certainly something that we could do with Dynamo.

Good luck!

1 Like

@Konrad yes that was I wanted - from a external material library.

How can I create new ones from a excel file? That could be a solution!

Thanks :wink:

Don’t hold be up to this, but you might be able to copy the materials from one project ( let’s say a company template with all materials pre-loaded) to your current project with the following method:


I’ve never tried this personally.

Thanks for the suggestion, but I am not (yet) skilled enough to know what to do with the codes :confused:

Anyone that knows how to handle the code in Dynamo?


Great idea! I can have a look at this and get back to you later.

Daniel, I finally found some time to have a quick look at this issue, and it turns out that Dimitar was correct. Yes, you can use the CopyElements() method to copy all materials from one project to another. Here's what the full code would look like: # Copyright(c) 2015, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

# Import Element wrapper extension methods
import clr
import Revit

# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

# Import RevitAPI
import Autodesk
from Autodesk.Revit.DB import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'

#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN

RunIt = IN[1]

class CustomCopyHandler(IDuplicateTypeNamesHandler):
 def OnDuplicateTypeNamesFound(self, args):
 return DuplicateTypeAction.UseDestinationTypes

 if RunIt:
 # Start Transaction
 errorReport = None
 fileDoc = app.OpenDocumentFile(IN[0])
 filter = ElementClassFilter(Material)
 allMat = FilteredElementCollector(fileDoc).WherePasses(filter).ToElementIds()
 trans = Autodesk.Revit.DB.Transform.Identity
 co = CopyPasteOptions()
 newIds = ElementTransformUtils.CopyElements(fileDoc, allMat, doc, trans, co)
 output = []
 if newIds != None:
 for i in newIds:
 # End Transaction
 errorReport = "Set Run it to true!"

 # if error accurs anywhere in the process catch it
 import traceback
 errorReport = traceback.format_exc()

#Assign your output to the OUT variable
if errorReport == None:
 OUT = output
 OUT = errorReport
1 Like

This forum is annoying but I can’t do anything about it so have fun re-typing it:


Thanks Konrad! It works great! :slight_smile:

Here is the Dynamo file: https://www.dropbox.com/s/qz2ecq5a9o89oq2/loadMaterials_fromTemplateFilePath.dyn?dl=0

I was wondering if it were possible to add other Project Standards from selected file, like Object Styles etc? I tried to add a modified line after line 41 and replaced Material with Object Styles. That did not work. What would be the right line in this case?



Great thread going on here. Just wanted your views on this:
In current scenario i am able to extract the Apperence asset laoded into the current document. How do i access the standard asset library of revit