Code: [Select]Acad::ErrorStatus erase(
);
Adesk::Boolean erasing = true
ParametersCode: [Select]Adesk::Boolean erasing = true
Input Boolean indicating if object is to be erased or unerased
Description
Sets the erase bit of the object. If erasing == Adesk::kTrue, then the erase bit is set on. If erasing == Adesk::kFalse, then the erase bit is set off.
Note
This does not remove the object from the database, nor from memory. However, if the erase bit is set when the database is saved or output to DXF, the object is not filed out and thus is not present the next time the file is opened.
Any object in the database can be erased with the following function:Code: [Select]Acad::ErrorStatus
Note The erase() function has different results for database objects and entities, with consequences for unerasing them:
AcDbObject::erase(
Adesk::Boolean Erasing = true);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.
- 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).
Code: [Select]extern Acad::ErrorStatus
To open an erased object, use kTrue for the last parameter of the acdbOpenObject() function.
acdbOpenObject(
AcDbObject*& obj,
AcDbObjectId objId,
AcDb::OpenMode openMode,
Adesk::Boolean openErasedObject = Adesk::kFalse);
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.