MaterialAppearanceAssetId Property |
The ElementId of the AppearanceAssetElement.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic ElementId AppearanceAssetId { get; set; }
Public Property AppearanceAssetId As ElementId
Get
Set
public:
property ElementId^ AppearanceAssetId {
ElementId^ get ();
void set (ElementId^ value);
}
member AppearanceAssetId : ElementId with get, set
Property Value
ElementId
The id of the AppearanceAssetElement, or InvalidElementId if the material does not have an associated
appearance asset.
Exceptions
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
Color and
Transparency will dictate the appearance of the material during rendering.
Exampleprivate 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;
}
}
}
}
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
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also