The ElementId of the AppearanceAssetElement.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)
Since:
2014
Syntax
C# |
---|
public ElementId AppearanceAssetId { get; set; } |
Visual Basic |
---|
Public Property AppearanceAssetId As ElementId
Get
Set |
Field Value
The id of the AppearanceAssetElement, or InvalidElementId if the material does not have an associated
appearance asset.
Remarks
Examples
CopyC#
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;
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)
{
break;
}
}
}
}
CopyVB.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
If theAsset.Size = 0 Then
Dim systemAppearanceAssets As IList(Of Asset) = document.Application.GetAssets(AssetType.Appearance)
For Each systemAsset As Asset In systemAppearanceAssets
If theAsset.LibraryName = systemAsset.LibraryName AndAlso theAsset.Name = systemAsset.Name Then
Exit For
End If
Next
End If
End Sub
Exceptions
See Also