AppearanceAssetId Property


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

C#
public ElementId AppearanceAssetId { get; set; }
Visual Basic
Public Property AppearanceAssetId As ElementId
	Get
	Set
Visual C++
public:
property ElementId^ AppearanceAssetId {
	ElementId^ get ();
	void set (ElementId^ value);
}

Examples

Copy C#
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;
         }
      }
   }
}
Copy VB.NET
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

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →