Create Materials with Appearance color value using GeniusLoci package

Hi all,

I am trying to map colors as real materials in Revit so that I could render them.
I have successfully created the materials as shown below with the Graphics color created but the Appearance asset color value doesn’t change. I tried a node from GeniusLoci package but it just gives me null values. I still have no knowledge of Python and can’t really understand the code inside the node T_T. I hope somebody can assist. Thank you so much!!

Created Materials with Graphics color but no color in Appearance asset tab

Null values using Material Set Render Appearance color which is supposed to copy the Graphics color values to the Appearance Asset color:

Material Set Render Appearance color python code:

import clr
from Autodesk.Revit.DB import *
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

def tolist(obj):
    if hasattr(obj, '__iter__'): return obj
    else: return [obj]

materials = tolist(UnwrapElement(IN[0]))

for mat in materials :
	appearanceAssetId = mat.AppearanceAssetId
	assetElem = doc.GetElement(appearanceAssetId)
	with Visual.AppearanceAssetEditScope(assetElem.Document) as editScope:
		editableAsset = editScope.Start(assetElem.Id)
		genericDiffuseProperty = editableAsset.FindByName("generic_diffuse")

OUT = materials


Can you try taking the Python code out of the custom node and put it into a python node and see if any errors show up?

1 Like

Hi @archjahzzy,

You must add an appearance asset for each material before you change the color of the appearance asset or add a texture or a tint color.
Use the Material Create and Add AppearanceAssetElement node.


Hi @Alban_de_Chasteigner, thank you!

I am not sure why mine doesn’t work… do you have any idea? I sampled 4 items from the list because I have over a thousand materials:

Can you try flattening the inputs and removing the list levels?

and here’s the flattened version:

here’s a more complete graph:

1 Like

Do you have a material called “Default” ?
Are you working with Revit 2018.1 or later ?

If so, can you drop a sample file please ?

I am using 2018.3, and yes there is a material called “Default”… but the materials I’m creating have different names. I will send you the file.

1 Like

Well, it works on my side on your purged file.


Strange. Maybe it was just a bug? Anyways, thank you so much! I’ll try it again tomorrow. Hopefully it will work.

Hi all,

I guess the problem is in the computing power of my pc or it’s just buggy. It works when I split the material creation by batches of around 200 materials. :slight_smile: but gives null values when I run all of them.

But the node works after using the Material Create and Add AppearanceAssetElement node.

Thanks all!

Hey everyone. I’d love to see the complete script as well, if possible. Great solution to an annoying problem. /E

I’d love to see the complete script too