C++
inline Acad::ErrorStatus acdbOpenAcDbEntity( AcDbEntity*& pEnt, AcDbObjectId id, AcDb::OpenMode mode, bool openErasedEntity = false );
File
dbmain.h
Description
This function provides a means to open database-resident objects that are derived from AcDbEntity (that is, have graphics). The function is passed in an empty pointer, pEnt. id is the object ID of the object to open. mode is the mode to open in. openErasedEntity is a Boolean indicating whether or not to open the object if it's erased.
The mode argument may be one of the following:
AcDb::kForRead
AcDb::kForWrite
AcDb::kForNotify
If the open attempt is successful, then pEnt will be set to the address of the object and Acad::eOk will be returned.
If openErasedEntity is false, then attempting to open an erased object will fail and this function will return Acad::eWasErased.
If attempting to open AcDb::kForRead and the object is already opened for read the maximum of 256 times, then the open attempt will fail and this function will return Acad::eAtMaxReaders.
If the object is currently open AcDb::kForNotify, then the open attempt will fail and this function will return Acad::eWasNotifying.
If the object is currently involved in an undo operation, then the open attempt will fail and this function will return Acad::eWasOpenForUndo.
If the object is currently open AcDb::kForWrite, then the open attempt will fail and this function will return Acad::eWasOpenForWrite.
If objId is AcDbObjectId::kNull, then the open attempt will fail and this function will return Acad::eNullObjectId.
Parameters
Parameters | Description |
---|---|
pEnt | Output pointer to the opened object |
id | Input object ID of the object to open |
mode | Input mode in which to open the object |
openErasedEntity | Input Boolean indicating whether it's OK to open an erased entity |