Share
 
 

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:
  • When a database object is erased, information about that object is removed from the dictionary. If the object is unerased with erase(kfalse), the information is not automatically reintroduced. You must use the setAt() function to add the information to the dictionary again.
  • When an entity is erased, it is simply flagged as erased in the block table record. The entity can be unerased with erase(kfalse).

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.

Was this information helpful?