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 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 def tolist(obj): if hasattr(obj, '__iter__'): return obj else: return [obj] materials = tolist(UnwrapElement(IN)) for mat in materials : appearanceAssetId = mat.AppearanceAssetId assetElem = doc.GetElement(appearanceAssetId) TransactionManager.Instance.EnsureInTransaction(doc) with Visual.AppearanceAssetEditScope(assetElem.Document) as editScope: editableAsset = editScope.Start(assetElem.Id) genericDiffuseProperty = editableAsset.FindByName("generic_diffuse") genericDiffuseProperty.SetValueAsColor(mat.Color) editScope.Commit(True) TransactionManager.Instance.TransactionTaskDone() OUT = materials