查看单个帖子
旧 2009-05-07, 05:37 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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:ninsertoleobject()
{
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...
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)