- 积分
- 3252
- 明经币
- 个
- 注册时间
- 2001-6-11
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-4-10 11:32:00
|
显示全部楼层
Suggestion
AcDbObjectId id,bid;
AcDbBlockTable* pbTable;
AcDbBlockTableRecordIterator * pbIterator;
AcDbBlockTableRecord *pBlock;
AcDbDatabase *pDb =new AcDbDatabase(Adesk::kFalse);
AcDbEntity *pbObj;
ads_name ents,ent;
acDocManager->lockDocument(acDocManager->curDocument()) ;
acedSSAdd(NULL, NULL, ents);
AfxMessageBox(sFileName);
int rt;
rt=pDb->readDwgFile(sFileName,_SH_DENYNO,false);
acutPrintf("\nrt==%d",rt);
if(rt==Acad::eOk )
{
char pName[64];
CString sTemp;
if(pDb->getBlockTable( pbTable,AcDb::kForRead)==Acad::eOk)
{
pbTable->getAt(ACDB_MODEL_SPACE, pBlock, AcDb::kForRead);
if(pBlock->newIterator(pbIterator, true, true)==Acad::eOk)
{
for(pbIterator->start(true,true);!pbIterator->done(); pbIterator->step(true,true))
{
if(pbIterator->getEntity(pbObj,AcDb::kForWrite,false) ==Acad::eOk)
{
strcpy(pName,pbObj->isA()->name());
sTemp=pName;
acutPrintf("\tstemp=%s",sTemp);
///////////////
//////////
id=pbObj->objectId ();
if(acdbGetAdsName(ent,id)==Acad::eOk )
{
if (acedSSAdd(ent, ents, ents) != RTNORM) {
acutPrintf("\nUnable to add entity to selection set\n");
}
}
pbObj->close();
}
}
delete pbIterator;
}
pBlock->close();
pbTable->close();
}
}
else acutPrintf("no dwg"); |
|