lgtq 发表于 2006-3-10 21:15:00

诸位朋友,如何 用setxdata 方法删除实体扩展数据?

<P>&nbsp;我是这样做的,但是错了.... </P>
<P>我调了一晚上,郁闷的很.</P>
<P>&nbsp;void clearname(AcDbPolyline* pPolyline)<BR>{&nbsp;struct&nbsp; resbuf&nbsp; *pRb=NULL;<BR>&nbsp;pPolyline-&gt;upgradeOpen();<BR>&nbsp;pPolyline-&gt;setXData(pRb);<BR>&nbsp;pPolyline-&gt;close();<BR>&nbsp;acutRelRb(pRb);<BR>}</P>

lgtq 发表于 2006-3-10 21:26:00

我 pRb-&gt;...type=1001也试过 不行.

chengxdong 发表于 2006-7-20 20:23:00

<P>我试过,可以的.&nbsp;</P>
<P>&nbsp; pRb-&gt;restype=1001;<BR>&nbsp;&nbsp; pTemp = pRb;<BR>&nbsp;&nbsp; pTemp-&gt;rbnext=NULL;</P>
<P>pObj-&gt;setXData(pRb)</P>

pipilu 发表于 2006-7-25 16:37:00

<P>//----------------------------------------------------------------------------------------------------<BR>//&nbsp;created:&nbsp;22/7/2006&nbsp;&nbsp; 17:53&nbsp;&nbsp; ShangHai<BR>//&nbsp;author:&nbsp;&nbsp;PiPi&nbsp;<BR>//&nbsp;purpose:&nbsp;Delete X-Data of a entity, no matter if there is X-Data attached to the entity<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when we fail to store a flange,but some information has already been added as x data,<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; we need to delete these x data for consistency<BR>//----------------------------------------------------------------------------------------------------<BR>bool DelXData(AcDbObjectId adoiEntity)<BR>{<BR>&nbsp;&nbsp;&nbsp; //Open the entity for editing<BR>&nbsp;&nbsp;&nbsp; AcDbEntity *padEntity;<BR>&nbsp;&nbsp;&nbsp; if (acdbOpenAcDbEntity(padEntity, adoiEntity, AcDb::kForWrite) != Acad::eOk) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<BR>&nbsp;&nbsp;&nbsp; }//end if</P>
<P>&nbsp;&nbsp;&nbsp; //Get x data result buffer of the entity<BR>&nbsp;&nbsp;&nbsp; resbuf *rbXdata = padEntity-&gt;xData(NULL);</P>
<P>&nbsp;&nbsp;&nbsp; //result buffer not null<BR>&nbsp;&nbsp;&nbsp; if (rbXdata) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rbXdata-&gt;rbnext = NULL;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; padEntity-&gt;setXData(rbXdata);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; acutRelRb(rbXdata);<BR>&nbsp;&nbsp;&nbsp; }//end if</P>
<P>&nbsp;&nbsp;&nbsp; padEntity-&gt;close();</P>
<P>&nbsp;&nbsp;&nbsp; return true;</P>
<P>}//end of function : DelXData()<BR></P>

fuzhishui 发表于 2014-6-17 22:19:16

pipilu 发表于 2006-7-25 16:37 static/image/common/back.gif
//-------------------------------------------------------------------------------------------------- ...

兄弟   太谢谢你了
页: [1]
查看完整版本: 诸位朋友,如何 用setxdata 方法删除实体扩展数据?