查看单个帖子
旧 2009-05-07, 05:35 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】undo On Entity Fields

undo on entity fields
undo on entity fields
hi,
i am trying change end points of line. and then try to undo it. is this supported? example code is as follows:
getoddbdatabase()->startundorecord();
pnewline->setstartpoint(ptstart);
pnewline->setendpoint(ptend);
id = pspace->appendoddbentity(pnewline); //this change gets undone
getoddbdatabase()->startundorecord();
pline = id.safeopenobject(oddb::kforwrite);
pline->setstartpoint(ptnewstart); //this change doesn't get undone
pline->setendpoint(ptnewend); //this change doesn't get undone
is there any other way to undo these field changes? here, i am using line as an example but i am wondering if this is true for all oddbentities?
thx.
this is result of dd undo recording defect.
if object is still opened it has "newobject" flag set even after second startundorecord() call. as a result undo is not written.
as a work around you can close the object - smart pointer to it should go out of scope (destroyed) or zeroed.
code below works (red line inserted)
code:
pdb->startundorecord();
oddblineptr pnewline = oddbline::createobject();
pnewline->setstartpoint(odgepoint3d(0,0,0));
pnewline->setendpoint(odgepoint3d(10,10,0));
oddbblocktablerecordptr pspace = pdb->getactivelayoutbtrid().openobject(oddb::kforwrite);
oddbobjectid id = pspace->appendoddbentity(pnewline);
pnewline = 0; // heels the problem
pdb->startundorecord();
oddblineptr pline = id.safeopenobject(oddb::kforwrite);
pline->setstartpoint(odgepoint3d(5,5,0));
pline->setendpoint(odgepoint3d(5,20,0));
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)