几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】undo On Entity Fields (http://www.dimcax.com/hust/showthread.php?t=18868)

yang686526 2009-05-07 05:35 PM

【转帖】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


所有的时间均为北京时间。 现在的时间是 02:55 PM.