试图更改CAD文件中数字标注内容时出错,源码如下: //打开数据库 AcDbBlockTable *pBlockTable; acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable,AcDb::kForWrite); AcDbBlockTableRecord *pBlockTableRecord; pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite); pBlockTable->close(); AfxMessageBox("open model space"); //创建块表记录遍历器,用遍历器遍历实体,并修改标注值。 AcDbRotatedDimension *pDimention; char* Texttemp; ACHAR* Astr; Astr="111"; AcDbBlockTableRecordIterator *pBlockIterator; pBlockTableRecord->newIterator(pBlockIterator); for(pBlockIterator->start();!pBlockIterator->done();pBlockIterator->step()) { AcDbEntity *pEntity; pBlockIterator->getEntity(pEntity,AcDb::kForWrite); const char *pCname=pEntity->isA()->name(); if(strcmp(pCname,"AcDbRotatedDimension")==0) { pDimention=AcDbRotatedDimension::cast(pEntity); Texttemp=pDimention->dimensionText(); if(strcmp(Texttemp,"e")==0) { AfxMessageBox("found linedim"); pDimention->setDimensionText(Astr); } } } delete pBlockIterator; pBlockTableRecord->close(); 出错提示:内部错误:!scandr.cpp@803:eWasOpenForWrite 是不是CAD文件在打开时,不能用ARX修改实体。 期盼高手指点!!!
|