实体的句柄类型,实体的句柄在dwg图中可以唯一标识一个实体,并且它能随图保存。由句柄就能得到实体的ID(调用McDbDatabase::getAcDbObjectId()函数),就能得到实体对象
class McDbHandle;
McDbHandle.h
例如:由实体名柄得到实体ID的例程代码
McDbHandle handle(_T("1A388")); McDbObjectId retId; acdbHostApplicationServices()->workingDatabase()->getAcDbObjectId(retId,false,handle);
由实体ID得到实体名柄的例程代码 McDbObjectId entId = pickedEntities[0]; McDbObjectPointer<McDbEntity> spEnt(entId,McDb::kForRead); if(spEnt.openStatus() == Mcad::eOk) { McDbHandle handle; spEnt->getAcDbHandle(handle); TCHAR szHandle[256]; handle.getIntoAsciiBuffer(szHandle); }