查看单个帖子
旧 2009-05-07, 06:56 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】when Entities That Have Display Order Are Copied, Regen Is W

when entities that have display order are copied, regen is w
when entities that have display order are copied, regen is wrong
here is a sample code which i have tried with the odamfcappdll (dwgdirect 1.12):
code:
oddbentityptr getnewline()
{
oddblineptr pline = oddbline::createobject();
pline->setstartpoint(odgepoint3d(0,0,0));
pline->setendpoint(odgepoint3d(10,0,0));
return pline;
}
void cdwgview:ntestcommandsdisplayorderbug()
{
try {
oddbdatabase* pdb = getdocument();

// create a line in the model space
oddbobjectid ident;
{
oddbblocktablerecordptr pblock =
pdb->getmodelspaceid().safeopenobject(oddb::kforwrite);
ident = pblock->appendoddbentity( getnewline() );
}

// register new entity in the display order stuff
{
oddbblocktablerecordptr pblock = pdb->getmodelspaceid().safeopenobject(oddb::kforwrite);
oddbsortentstableptr psortentstable = pblock->getsortentstable();
oddbobjectidarray ids; ids.push_back(ident);
psortentstable->movetotop(ids);
}

// create a copy of that line
oddbobjectid idcopiedent;
{
oddbobjectidarray ids;
ids.push_back(ident);
oddbidmappingptr pmapping = oddbidmapping::createobject();
pdb->deepcloneobjects(ids,pdb->getmodelspaceid(),*pmapping);

oddbidpair idpair(ident);
pmapping->compute(idpair);
idcopiedent = idpair.value();
oda_assert(!idcopiedent.isnull());
}

// translate the copy
{
oddbentityptr pent = idcopiedent.safeopenobject(oddb::kforwrite);
pent->transformby(odgematrix3d::translation(odgevector3d(0,10,0)));
}

getdocument()->updateallviews(null);

} catch(oderror& e) {
theapp.reporterror("error", e);
} //catch


}
if you remove the little section "register new entity in the display order stuff", and select regen, the 2 lines are rendered.
but if this section is present, only the first line is rendered.
it seems that in this case the iterator returned by the call oddbblocktablerecord::newiterator(true,true,true); (the last argument = true) do not iterate properly (it is used in the oddbblocktablerecord::worlddraw())
please can someone help how to avoid this problem.
thank you in advance
best regards
chudomir

thanks again, chudomir. this is a bug of dd.
it fixed in 1.12.04, that was posted yesterday.
sincerely yours,
george udov
thanks you! i'll check it out asap.
best regards
chudomir
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)