Setting AppearanceAsset properties of newly created Revit Material

By Naveen Kumar

Question: One can change the AppearanceAsset properties of a UI-generated Revit material. However, the AppearanceAssetId value is null if the material is API-generated. The AppearanceAsset properties cannot be set for the material created by the API. Is it possible to modify or set the AppearanceAsset properties of an API-generated Material?

Answer: Since the API-generated material lacks an AppearanceAssetId , it should be set explicitly. In this case, the simplest way to create a new material is to duplicate an existing one and then modify it.

In the code below, red carpet material has been duplicated, and the AppearanceAsset properties of the duplicated material have been modified.

 

public void DuplicateAndModifyMaterial(Material material)
      {
        ElementId appearanceAssetId = material.AppearanceAssetId;
        AppearanceAssetElement assetElem = material.Document
.GetElement(appearanceAssetId) as AppearanceAssetElement;
...

Read more