勤奋 发表于 2005-11-13 16:09:00

请问用ARX中用什么来删除一个实体对象 ?在线等待

目前已有该实体的AcDbObjectId,用什么方法把它从当前数据库中删除?

王咣生 发表于 2005-11-13 22:07:00

reply

<P>1.</P>
<P class=signature>inline Acad::ErrorStatus</P>
<P class=signature>acdbOpenObject(</P>
<P class=signatureIn>AcDbObject *&amp; pObj,</P>
<P class=signatureIn>AcDbObjectId id,</P>
<P class=signatureInEnd>AcDb::OpenMode mode);</P>
<P class=signatureInEnd>2.调用obj的erase方法</P>

zhang007 发表于 2005-11-15 15:37:00

<P>等于没说。</P>
<P>上面的都是已知的,关键是erase是在obj打开后就进行还是obj关闭后进行。还是自己试试看</P>

王咣生 发表于 2005-11-15 18:18:00

reply

本帖最后由 作者 于 2005-11-15 18:41:04 编辑 <br /><br /> zhang007发表于2005-11-15 15:37:00static/image/common/back.gif
等于没说。
上面的都是已知的,关键是erase是在obj打开后就进行还是obj关闭后进行。还是自己试试看


<P>晕!!!!!!</P>
<P>从ID得到对象用acdbOpenObject(AcDbObject*&amp; pObj,AcDbObjectId id, AcDb::OpenMode mode);其中pObj是输出参数,id是已知参数,要操作对象当然要先打开对象了,关闭后还怎么操作它啊?不明白你在回答什么???</P>
<P><EM>希望对你的回答负责!</EM></P>

pglyxq 发表于 2005-11-15 21:55:00

tigerhu 发表于 2005-11-18 13:46:00

<P>acdbOpenObject(pObj,id,acdb::kforwrite);//pobj:AcDbEntity *</P>
<P>pobj-&gt;erase();</P>
<P>pobj-&gt;close();</P>

houdy 发表于 2005-11-24 19:45:00

<P>erase() is a method of AcDbObject, it doesn't really remove the object/entity from the database, it just set the erase bit to true, when drawing is going to be persisted, any objects with true erase bit will not be persisted.</P>
<P>So do as tigerhu do:</P>
<P>open the object/entity</P>
<P>call erase method</P>
<P>close the object/entity&nbsp;</P>

zltangent 发表于 2011-10-17 18:52:40

mark等待牛人解答

zltangent 发表于 2011-10-17 18:59:44

tigerhu 发表于 2005-11-18 13:46 static/image/common/back.gif
acdbOpenObject(pObj,id,acdb::kforwrite);//pobj:AcDbEntity *
pobj-&gt;erase();
pobj-&gt;close();

对象指针已经删了,在关闭还有意义吗???
By default, you cannot open an erased object with the acdbOpenObject() function. If you attempt to do so, the eWasErased error code will be returned.

extern Acad::ErrorStatus
acdbOpenObject(
    AcDbObject*& obj,
    AcDbObjectId objId,
    AcDb::OpenMode openMode,
    Adesk::Boolean openErasedObject = Adesk::kFalse);
To open an erased object, use kTrue for the last parameter of the acdbOpenObject() function
所以对块表中不存在的对象,要这样打开,才可以关闭吧。
页: [1]
查看完整版本: 请问用ARX中用什么来删除一个实体对象 ?在线等待