suker23 发表于 2006-1-24 22:57:00

[ARX]这段代码为什么老出错?

本帖最后由 作者 于 2006-1-25 0:29:23 编辑 <br /><br /> <P>&nbsp;ads_name entname;<BR>&nbsp;ads_point ptt;<BR>&nbsp;AcDbObjectId entId;<BR>&nbsp;AcDb2dPolyline*&nbsp; pent;<BR>&nbsp;acedEntSel("\n选择多段线",entname,ptt);<BR>&nbsp;acdbOpenObject(pent,entId,AcDb::kForRead);//在这里出错<BR>&nbsp;AcDbObjectIterator* pvertexiter=pent-&gt;vertexIterator();//<BR>&nbsp;pent-&gt;close();<BR>&nbsp;AcDb2dVertex *pvertex;<BR>&nbsp;AcGePoint3d location;<BR>&nbsp;AcDbObjectId vertexId;</P>
<P>&nbsp;for(int i=0;!pvertexiter-&gt;done();i++,pvertexiter-&gt;step())<BR>&nbsp;{<BR>&nbsp;&nbsp;vertexId=pvertexiter-&gt;objectId();<BR>&nbsp;&nbsp;acdbOpenObject(pvertex,vertexId,AcDb::kForRead);<BR>&nbsp;&nbsp;location=pvertex-&gt;position();<BR>&nbsp;&nbsp;pvertex-&gt;close();<BR>&nbsp;&nbsp;acutPrintf("\n 坐标 x=%0.3f,y=%0.3f,z=%0.3f",location,location,location);<BR>&nbsp;}<BR>&nbsp;delete&nbsp; pvertexiter;<BR>&nbsp;该怎么调试?</P>

houdy 发表于 2006-2-5 14:52:00

<P>Acad::ErrorStatus dbStatus =&nbsp;acdbOpenObject(pent,entId,AcDb::kForRead);</P>
<P>在Debug模式下,根据dbStatus的值判断出可能的错误。</P>

kkr824 发表于 2006-2-6 22:51:00

<P>试试</P>
<P>Acad::ErrorStatus es = acdbOpenAcDbEntity((AcDbEntity *&amp;)pent,entId,AcDb::kForRead);</P>

HuaiYu 发表于 2006-2-13 20:16:00

<P>这是那个书上的例子吧,我也遇到了这个问题,也正烦着呢</P>
<P>&nbsp;</P>

arbyao 发表于 2006-2-15 11:56:00

<P>好像没给entId赋值啊</P>
<P>&nbsp;</P>

easypower 发表于 2006-2-15 20:28:00

<P>AcDb2dPolyline*&nbsp; pent;<BR>改成</P>
<P>AcDbPolyline* pent;</P>
页: [1]
查看完整版本: [ARX]这段代码为什么老出错?