請教!
arx中用pdb->readDwgFile讀進圖檔,但不顯示圖檔,可以生成一個sselection set 嗎?如有沒有辦法使用acedSSGet(NULL,p1,p2,pklist,ssname)?
是不是要將讀進的圖檔設為當前圖檔working database?
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;
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");
这段代码里就有LOCKDocument
这段码本身不需Lockdocument. 但如果这段代码用在非模式对话框情况,或者所在的ARX命令是ACRX_CMD_SESSION,(看ADDCOMMAND看出来).或者..,就应当锁定文挡,否则readDwgFile等函数会出问题.当SDI系统变量设为1时,系统在有些情况下会自动执行Lock与Unlock的工作.
页:
[1]