Revit 2015 API |
Material..::..AppearanceAssetId Property |
Material Class Example See Also |
The ElementId of the AppearanceAssetElement.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since:
2014
Syntax
Examples

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) { AssetSet systemAppearanceAssets = document.Application.get_Assets(AssetType.Appearance); foreach (Asset systemAsset in systemAppearanceAssets) { if(theAsset.LibraryName == systemAsset.LibraryName && theAsset.Name == systemAsset.Name) { // Read the Asset information here. break; } } } }

Private Sub ReadMaterialAppearanceProp(document As Document, material As Material) Dim appearanceId As ElementId = material.AppearanceAssetId Dim appearanceElem As AppearanceAssetElement = TryCast(document.GetElement(appearanceId), AppearanceAssetElement) Dim theAsset As Asset = appearanceElem.GetRenderingAsset() Dim libraryName As String = theAsset.LibraryName Dim title As String = theAsset.Title ' The predefined asset can be empty. at this time, get the system appearance asset instead. If theAsset.Size = 0 Then Dim systemAppearanceAssets As AssetSet = document.Application.Assets(AssetType.Appearance) For Each systemAsset As Asset In systemAppearanceAssets If theAsset.LibraryName = systemAsset.LibraryName AndAlso theAsset.Name = systemAsset.Name Then ' Read the Asset information here. Exit For End If Next End If End Sub
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions..::..ArgumentNullException | When setting this property: A non-optional argument was NULL |