Skip to content

Material.AppearanceAssetId

Public Property

The ElementId of the AppearanceAssetElement.

Namespace: Autodesk.Revit.DB

Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)

Syntax

public ElementId AppearanceAssetId { get; set; }

Property Value

ElementId
The id of the AppearanceAssetElement, or InvalidElementId if the material does not have an associated appearance asset.

Exceptions

Exception

Condition


ArgumentNullException

When setting this property: A non-optional argument was null


Remarks

This is the id to the element that contains visual material information used for rendering. In some cases where the material is created without setting up custom render appearance properties (for example, when the material is created via an import, or when it is created by the API), this property will be InvalidElementId. In that situation the standard material properties such as

and will dictate the appearance of the material during rendering.

Example

private void ReadMaterialAppearanceProp(Document document, Material material)
{
ElementId appearanceId = material.AppearanceAssetId;
AppearanceAssetElement appearanceElem = document.GetElement(appearanceId) as AppearanceAssetElement;
Asset theAsset = appearanceElem.GetRenderingAsset();
string libraryName = theAsset.LibraryName;
string title = theAsset.Title;
// The predefined asset can be empty. at this time, get the system appearance asset instead.
if (theAsset.Size == 0)
{
IList<Asset> systemAppearanceAssets = document.Application.GetAssets(AssetType.Appearance);
foreach (Asset systemAsset in systemAppearanceAssets)
{
if(theAsset.LibraryName == systemAsset.LibraryName
&& theAsset.Name == systemAsset.Name)
{
// Read the Asset information here.
break;
}
}
}
}