|
[code]static AcDbObjectId AppendEntity(AcDbEntity *pEnt)
{
AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase();
AcDbBlockTable *pBt;
pDb->getBlockTable(pBt, AcDb::kForRead);
AcDbBlockTableRecord *pBtr;
pBt->getAt(ACDB_MODEL_SPACE, pBtr, AcDb::kForWrite);
AcDbObjectId entId;
pBtr->appendAcDbEntity(entId, pEnt);
pBtr->close();
pBt->close();
pEnt->close();
return entId;
}
// - ahlzlARX._test command (do not rename)
static void ahlzlARX_test(void)
{
// Add your code for command ahlzlARX._test here
ads_name ent;
ads_point pt;
if (acedEntSel(_T("\n请选择对象:"), ent, pt) != RTNORM)
{
return;
}
AcDbObjectId entId;
acdbGetObjectId(entId, ent);
AcDbEntity *pEnt = NULL;
acdbOpenObject(pEnt, entId, AcDb::kForWrite);
AcDbVoidPtrArray pExps;
if (pEnt->explode(pExps) == Acad::eOk)
{
for (int i = 0; i < pExps.length(); i++)
{
AcDbEntity *pExpEnt = (AcDbEntity*)pExps[i];
acutPrintf(_T("\n分解后的对象类型名是: %s"), (pExpEnt->isA()->name()));
AppendEntity(pExpEnt);
}
pEnt->erase(true);
}
else
{
acutPrintf(_T("\n该对象不能被分解!"));
}
pEnt->close();
}[/code] |
|