![]() |
【转帖】undoredo Problem
undo/redo problem
undo/redo problem hi to all, we have problems with the undo/redo functionality in dwgdirect 2.5.2. i wrote the following code to simulate the problem in the odamfcapp sample using the insetoleobject command as an entry point: code: void copysel(oddbobjectid idline, oddbdatabaseptr m_pdb, oddbobjectid& out) { try { oddbobjectid idowner; oddbentityptr pent0 = idline.safeopenobject(); idowner = pent0->blockid(); oddbblocktablerecordptr pownerblock = idowner.safeopenobject(); oddbidmappingptr idmap = oddbidmapping::createobject(); idmap->setdestdb(m_pdb); oddbobjectidarray objectids(1); objectids.push_back(idline); m_pdb->deepcloneobjects(objectids,idowner, *idmap); // now output oddbidpair pp(idline); if (idmap->compute(pp)) { out = (oddbstub*)pp.value(); } //if } catch (oderror& e) { } //catch } void codamfcappdoc::oninsertoleobject() { m_pdb->startundorecord(); oddblineptr pline1 = oddbline::createobject(); pline1->setstartpoint(odgepoint3d(10.,10,0.)); pline1->setendpoint(odgepoint3d(20.,20,0.)); oddbblocktablerecordptr pmodelspace = m_pdb->getmodelspaceid().openobject(oddb::kforwrite); oddbobjectid idline = pmodelspace->appendoddbentity(pline1); oddbobjectid idcopyline; copysel(idline, m_pdb, idcopyline); if (idcopyline){ oddblineptr pline2 = idcopyline.openobject(oddb::kforwrite); pline2->setstartpoint(odgepoint3d(10.,20,0.)); pline2->setendpoint(odgepoint3d(20.,30,0.)); }//if }you should call undo and after that redo after executing the command, but the result is: the second line generated by deepcloneobject() is disappeared. any ideas for that problem? thanks in advance for all the suggestions, nino ninov it exists in 2.7.1 prod too... is there any way to implement a workaround for that? sorry, we need some time to investigate the problem... |
所有的时间均为北京时间。 现在的时间是 01:10 PM. |