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

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

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

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

1.
inline Acad::ErrorStatus
acdbOpenObject(
AcDbObject *& pObj,
AcDbObjectId id,
AcDb::OpenMode mode);
2.调用obj的erase方法

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

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

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


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

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

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

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

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.
So do as tigerhu do:
open the object/entity
call erase method
close the object/entity

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

mark等待牛人解答

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


对象指针已经删了,在关闭还有意义吗???
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中用什么来删除一个实体对象 ?在线等待