|
[code]void CArrowsBlock::DeleteBlockRefByBlockName( CString& strBlockName )
{
AcDbObjectId objId;
bool bBlock = CArrowsBlock::IsBlock(strBlockName,objId);
acutPrintf(_T("\n bBlock = %d"),bBlock);
// 获得当前图形数据库的块表
AcDbBlockTable *pBlkTbl;
acdbHostApplicationServices()->workingDatabase() ->getBlockTable(pBlkTbl, AcDb::kForWrite);
// 创建新的块表记录
AcDbBlockTableRecord *pBlkTblRcd = NULL;
pBlkTbl->getAt(ACDB_MODEL_SPACE,pBlkTblRcd,kForRead);
pBlkTbl->close();
AcDbBlockTableRecordIterator *pIte = NULL;
Acad::ErrorStatus es;
es = pBlkTblRcd->newIterator(pIte);
AcDbEntity *pEnt = NULL;
int i = 0;
for(pIte->start(); !pIte->done(); pIte->step())
{
i++;
acutPrintf(_T("\n i = %d"),i);
pIte->getEntity(pEnt,AcDb::kForWrite);
//if (pEnt->id() == objId)
//{
bool dd = pEnt->isKindOf(AcDbBlockReference::desc());
acutPrintf(_T("\n 块参照 = %d"),dd);
if (dd)
{
es = pEnt->setColorIndex(1);
}
//}
pEnt->close();
}
delete pIte;
pBlkTblRcd->close();
}[/code] |
|