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

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

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

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

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

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

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