几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】when Entities That Have Display Order Are Copied, Regen Is W (http://www.dimcax.com/hust/showthread.php?t=19095)

yang686526 2009-05-07 06:56 PM

【转帖】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::ontestcommandsdisplayorderbug()
{
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


所有的时间均为北京时间。 现在的时间是 03:39 AM.