2027 Class
Changes 0
C

Asset

Description:
Represents a connected property of material.
Inheritance Hierarchy:
System.Object
  Autodesk.Revit.DB.Visual.AssetProperty
    Autodesk.Revit.DB.Visual.AssetProperties
      Autodesk.Revit.DB.Visual.Asset
public class Asset : AssetProperties
public void ReadAsset(Asset asset)
{
   // Get the asset name, type and library name.
   AssetType type = asset.AssetType;
   string name = asset.Name;
   string libraryName = asset.LibraryName;

   // travel the asset properties in the asset.
   for (int idx = 0; idx < asset.Size; idx++)
   {
      AssetProperty prop = asset.Get(idx);
      ReadAssetProperty(prop);
   }
}

public void ReadAssetProperty(AssetProperty prop)
{
   switch (prop.Type)
   {
      // Retrieve the value from simple type property is easy.
      // for example, retrieve bool property value.
      case AssetPropertyType.Boolean:
         AssetPropertyBoolean boolProp = prop as AssetPropertyBoolean;
         bool propValue = boolProp.Value;
         break;

      // When you retrieve the value from the data array property,
      // you may need to get which value the property stands for.
      // for example, the APT_Double44 may be a transform data.
      case AssetPropertyType.Double44:
         AssetPropertyDoubleArray4d transformProp = prop as AssetPropertyDoubleArray4d;
         IList<double> tranformValue = transformProp.GetValueAsDoubles();
         break;

      // The APT_List contains a list of sub asset properties with same type.
      case AssetPropertyType.List:
         AssetPropertyList propList = prop as AssetPropertyList;
         IList<AssetProperty> subProps = propList.GetValue();
         if (subProps.Count == 0)
            break;
         switch (subProps[0].Type)
         {
            case AssetPropertyType.Integer:
               foreach (AssetProperty subProp in subProps)
               {
                  AssetPropertyInteger intProp = subProp as AssetPropertyInteger;
                  int intValue = intProp.Value;
               }
               break;
         }
         break;

      case AssetPropertyType.Asset:
         Asset propAsset = prop as Asset;
         ReadAsset(propAsset);
         break;
      default:
         break;
   }

   // Get the connected properties.
   // please notice that the information of many texture stores here.
   if (prop.NumberOfConnectedProperties == 0)
      return;
   foreach (AssetProperty connectedProp in prop.GetAllConnectedProperties())
   {
      // Note: Usually, the connected property is an Asset.
      ReadAssetProperty(connectedProp);
   }
}
Name Return Type Description Inherited From
M AddConnectedAsset(String) None Adds a new connected asset attached to this asset property, if it allows it. (Inherited from AssetProperty ) AssetProperty
M AddCopyAsConnectedAsset(Asset) None Makes a copy of the asset and connects it to this property. (Inherited from AssetProperty ) AssetProperty
M Dispose() None (Inherited from AssetProperty ) AssetProperty
M Equals None Determines whether the specified object is equal to the current object. (Inherited from Object ) Object
M FindByName(String) AssetProperty Gets the property with the given name. (Inherited from AssetProperties ) AssetProperties
M Get(Int32) AssetProperty Gets the property at the given index. (Inherited from AssetProperties ) AssetProperties
M GetAllConnectedProperties() IList<AssetProperty> Gets the list of the connected properties. Connected properties are the detachable properties of an AssetProperty. e.g. diffuse property can have texture as its connected property. It can also detach texture on runtime. (Inherited from AssetProperty ) AssetProperty
M GetConnectedProperty(Int32) AssetProperty Gets one connected property with specified index. (Inherited from AssetProperty ) AssetProperty
M GetHashCode None Serves as the default hash function. (Inherited from Object ) Object
M GetSingleConnectedAsset() Asset Gets the single connected asset attached to this asset property, if it exists. (Inherited from AssetProperty ) AssetProperty
M GetType None Gets the Type of the current instance. (Inherited from Object ) Object
M IsEditable() Boolean Check if property can be edited. (Inherited from AssetProperty ) AssetProperty
M IsValidIndex(Int32) Boolean Returns true if the provided index is valid. (Inherited from AssetProperties ) AssetProperties
M IsValidSchemaIdentifier(String) Boolean Check that schema name is valid (Inherited from AssetProperty ) AssetProperty
M RemoveConnectedAsset() None Removes the connected asset attached to this asset property if any. (Inherited from AssetProperty ) AssetProperty
M ToString None Returns a string that represents the current object. (Inherited from Object ) Object
Name Return Type Description Inherited From
P AssetType AssetType The type of RenderingAsset
P IsReadOnly bool Identifies if the object is read-only or modifiable. If true, the object may not be modified. If false, the object's contents may be modified. (Inherited from AssetProperty ) AssetProperty
P IsValidObject Boolean Specifies whether the .NET object represents a valid Revit entity. (Inherited from AssetProperty ) AssetProperty
P Item AssetProperty (Inherited from AssetProperties ) AssetProperties
P LibraryName string Library name
P Name string Get the name of the AssetProperty (Inherited from AssetProperty ) AssetProperty
P NumberOfConnectedProperties int The number of currently connected properties. (Inherited from AssetProperty ) AssetProperty
P Size int The number of the AssetProperty(s) in the object. (Inherited from AssetProperties ) AssetProperties
P Title string Asset title
P Type AssetPropertyType Returns the type of the AssetProperty (Inherited from AssetProperty ) AssetProperty