TA的每日心情 | 开心 6 小时前 |
---|
签到天数: 20 天 [LV.4]偶尔看看III
管理员
- 积分
- 1393
|
- static void zffObjectARX采用MyCommand14(void)
- {
- // Add your code for command zffObjectARX.采用MyCommand14 here
- ACHAR* fileName;
- AcDbDatabase* pDb;
- AcDbObjectId transId;
- struct resbuf* filename;
- filename=acutNewRb(RTSTR);
- acedGetFileD(采用T("请选择要检出的图"),NULL,采用T("dwg"),0,filename);
- pDb=new AcDbDatabase(Adesk::kFalse);
- fileName=filename->resval.rstring;
- pDb->readDwgFile(fileName);
- AcDbBlockTable *pBlk=NULL;
- AcDbBlockTableRecord *pBlkRcd=NULL;
- pDb->getSymbolTable(pBlk,AcDb::kForRead);
- pBlk->getAt(ACDB采用MODEL采用SPACE,pBlkRcd,AcDb::kForRead);
- pBlk->close();
- AcDbObjectIdArray objIds;
- AcDbBlockTableRecordIterator* it=NULL;
- pBlkRcd->newIterator(it);
- pBlkRcd->close();
- AcDbEntity* pEnt=NULL;
- for (it->start();!it->done();it->step())
- {
- it->getEntity(pEnt,AcDb::kForRead);
- if (pEnt->isKindOf(AcDbCircle::desc()))
- {
- objIds.append(pEnt->objectId());
- }
- }
- pEnt->close();
- delete it;
- AcDbBlockTable* pBlkCur=NULL;
- AcDbBlockTableRecord* pBlkRcdCur=NULL;
- acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlkCur,AcDb::kForRead);
- pBlkCur->getAt(ACDB采用MODEL采用SPACE,pBlkRcdCur,AcDb::kForWrite);
- pBlkCur->close();
- AcDbObjectId objIdCur=pBlkRcdCur->objectId();
- pBlkRcdCur->close();
- AcDbIdMapping p;
- acapLongTransactionManagerPtr()->checkOut(transId,objIds,objIdCur,p);
- //AcDbObject* pObj=NULL;
- AcDbLongTransaction* pLongTrans;
- if (acdbOpenObject(pLongTrans,transId,AcDb::kForWrite)==Acad::eOk)
- {
- //AcDbLongTransaction* pLongTrans=AcDbLongTransaction::cast(pObj);
- AcDbLongTransWorkSetIterator* pItor=NULL;
- pLongTrans->newWorkSetIterator(pItor);
- int index;
- acedGetInt(采用T("\n输入要改变的颜色值:"),&index);
- for (pItor->start();!pItor->done();pItor->step())
- {
- AcDbEntity* pEnt1=NULL;
- acdbOpenObject(pEnt1,pItor->objectId(),AcDb::kForWrite);
- pEnt1->setColorIndex(index);
- pEnt1->close();
- }
- delete pItor;
- ACHAR str[20]={0};
- acedGetString(0,采用T("\n观察实体的改变,按回车结束!"),str);
- pLongTrans->close();
- }
- acapLongTransactionManagerPtr()->checkIn(transId,p);
- pDb->saveAs(fileName);
- acutRelRb(filename);
- delete pDb;
- pDb=NULL;
- }
复制代码 |
|