请问用ARX中用什么来删除一个实体对象 ?在线等待
目前已有该实体的AcDbObjectId,用什么方法把它从当前数据库中删除?reply
<P>1.</P><P class=signature>inline Acad::ErrorStatus</P>
<P class=signature>acdbOpenObject(</P>
<P class=signatureIn>AcDbObject *& pObj,</P>
<P class=signatureIn>AcDbObjectId id,</P>
<P class=signatureInEnd>AcDb::OpenMode mode);</P>
<P class=signatureInEnd>2.调用obj的erase方法</P> <P>等于没说。</P>
<P>上面的都是已知的,关键是erase是在obj打开后就进行还是obj关闭后进行。还是自己试试看</P>
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*& pObj,AcDbObjectId id, AcDb::OpenMode mode);其中pObj是输出参数,id是已知参数,要操作对象当然要先打开对象了,关闭后还怎么操作它啊?不明白你在回答什么???</P>
<P><EM>希望对你的回答负责!</EM></P> <P>acdbOpenObject(pObj,id,acdb::kforwrite);//pobj:AcDbEntity *</P>
<P>pobj->erase();</P>
<P>pobj->close();</P> <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 </P> mark等待牛人解答 tigerhu 发表于 2005-11-18 13:46 static/image/common/back.gif
acdbOpenObject(pObj,id,acdb::kforwrite);//pobj:AcDbEntity *
pobj->erase();
pobj->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]