Appearance |
The AppearanceAssetEditScope type exposes the following members.
Name | Description | |
---|---|---|
![]() | AppearanceAssetEditScope | Constructs a new instance of an AppearanceAssetEditScope. |
Name | Description | |
---|---|---|
![]() | IsActive | Identifies if the EditScope is active. In other words, the EditScope has started but not committed/canceled yet. |
![]() | IsValidObject | Specifies whether the .NET object represents a valid Revit entity. |
Name | Description | |
---|---|---|
![]() | Cancel | Cancels the edit scope. |
![]() | Commit | Finishes the edit scope. |
![]() | Dispose | Releases all resources used by the AppearanceAssetEditScope |
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object) |
![]() | Start | Starts the edit scope. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object) |
private void SetDiffuseColor(Material material, Color color) { ElementId appearanceAssetId = material.AppearanceAssetId; AppearanceAssetElement assetElem = material.Document.GetElement(appearanceAssetId) as AppearanceAssetElement; // A transaction is necessary. Multiple changes to the same asset can be made in one transaction if required. using (Transaction t = new Transaction(assetElem.Document, "Change material color")) { t.Start(); using (AppearanceAssetEditScope editScope = new AppearanceAssetEditScope(assetElem.Document)) { Asset editableAsset = editScope.Start(assetElem.Id); // returns an editable copy of the appearance asset // unlike AppearanceAssetElement.GetRenderingAsset(), the edit scope // sets up the asset for editing using the classes and utilities from // MaterialsManager. The scope can keep a mapping from asset to Protein // class members that are obtained from the asset, to permit use of // Protein validation. If the Asset was not obtained from an edit scope, // the setter operations for asset properties must throw. // Try to change values AssetPropertyDoubleArray4d genericDiffuseProperty = editableAsset.FindByName("generic_diffuse") as AssetPropertyDoubleArray4d; genericDiffuseProperty.SetValueAsColor(color); // 4 length double asset properties often represent colors. // Shortcut methods should be added to work directly with Color objects // for these types. // Commit the entire edit scope. If the appearance asset element is used in one or more materials, they will be // updated to match any changes made. editScope.Commit(true); } t.Commit(); } }