zackary 发表于 2007-12-16 16:24:00

试图更改CAD文件中数字标注内容时出错(附源码)

试图更改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();
出错提示:内部错误:
是不是CAD文件在打开时,不能用ARX修改实体。
期盼高手指点!!!
**** Hidden Message *****

zackary 发表于 2007-12-16 17:39:00

搞定了,实体没有关闭的缘故

hourui800720 发表于 2011-8-1 10:52:00

thank you
页: [1]
查看完整版本: 试图更改CAD文件中数字标注内容时出错(附源码)