EraseSchemaAndAllEntities Method


Erases all Entities corresponding to this Schema from all open documents, and erases this Schema from memory.

Namespace: Autodesk.Revit.DB.ExtensibleStorage
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)
Since: 2012

Syntax

C#
[ObsoleteAttribute("This method is deprecated in Revit 2021 and may be removed in the future version of Revit. To erase the schema and all its entities in one document, call document.EraseSchemaAndAllEntities().")]
public static void EraseSchemaAndAllEntities(
	Schema schema,
	bool overrideWriteAccessWithUserPermission
)
Visual Basic
<ObsoleteAttribute("This method is deprecated in Revit 2021 and may be removed in the future version of Revit. To erase the schema and all its entities in one document, call document.EraseSchemaAndAllEntities().")> _
Public Shared Sub EraseSchemaAndAllEntities ( _
	schema As Schema, _
	overrideWriteAccessWithUserPermission As Boolean _
)
Visual C++
[ObsoleteAttribute(L"This method is deprecated in Revit 2021 and may be removed in the future version of Revit. To erase the schema and all its entities in one document, call document.EraseSchemaAndAllEntities().")]
public:
static void EraseSchemaAndAllEntities(
	Schema^ schema, 
	bool overrideWriteAccessWithUserPermission
)

Parameters

schema
Type: Autodesk.Revit.DB.ExtensibleStorage Schema
The Schema to erase.
overrideWriteAccessWithUserPermission
Type: System Boolean
Normally, the usual write access controls apply to prevent deletion of Entities that you don't have write permissions for. However, the user may choose to override the controls. Set this flag to true only if the user gave explicit permission to destroy the Schema.

Remarks

The intent of this method is to let the user control the amount of memory consumed by Extensible Storage data. It may also be useful during development. Obviously, this method cannot erase the Schema from closed documents, so if a saved and closed document contains Entities of this Schema, it will reintroduce it into memory. Top-level Entities corresponding to this Schema are erased; subentities are replaced with invalid Entities. It may be tempting to use this method to replace subentities such that the GUID is the same, but the Schema definition is different. This will break schema uniqueness when a new Schema is already in memory, and the old one is in a newly opened file. Never assign the same GUID to different Schemas. This method will not erase schemas or entities in embedded families.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException No write access to this Schema.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null

See Also