|
- static void test(void)
- {
- 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();
- }
- 添加实体到数据库:
-
- 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;
- }
复制代码 |
|