Erasing Objects

Any object in the database can be erased with the following function:

Acad::ErrorStatus 
AcDbObject::erase(
    Adesk::Boolean Erasing = true);
Note: The erase() function has different results for database objects and entities, with consequences for unerasing them:

By default, you cannot open an erased object with the acdbOpenObject() function. If you attempt to do so, the eWasErased error code will be returned.

extern Acad::ErrorStatus
acdbOpenObject(
    AcDbObject*& obj,
    AcDbObjectId objId,
    AcDb::OpenMode openMode,
    Adesk::Boolean openErasedObject = Adesk::kFalse);

To open an erased object, use kTrue for the last parameter of the acdbOpenObject() function.

Container objects such as polylines and block table records usually provide the option of skipping erased elements when iterating over their contents. The default behavior is to skip erased elements.

Erased objects are not filed out to DWG or DXF files.