几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】changing blockref colour (http://www.dimcax.com/hust/showthread.php?t=15395)

yang686526 2009-05-04 05:43 PM

【转帖】changing blockref colour
 
changing blockref colour
changing blockref colour
i am trying to change the colour of block entities. i have successfully changed attribute values in a similar way :
oddbblocktableptr pblocks = m_pdb->getblocktableid().safeopenobject(oddb::kforwrite) ;
oddbsymboltableiteratorptr pblkiter = pblocks->newiterator();
for (pblkiter->start(); ! pblkiter->done(); pblkiter->step())
{
oddbblocktablerecordptr pblock = pblkiter->getrecordid().safeopenobject(oddb::kforwrite);
oddbobjectiteratorptr pentiter = pblock->newiterator();
// for each entity in the block
for (; !pentiter->done(); pentiter->step())
{
oddbentityptr pent = pentiter->objectid().safeopenobject(oddb::kforwrite);
if (!layeron(pent))
continue;
if (pent->iskindof(oddbblockreference::desc()))
{
trace("before ci %d\n",pent->colorindex());
pent->setcolorindex(0);
odcmcolor color;
color.setrgb(128,128,128);
pent->setcolor(color);
trace("after ci %d\n",pent->colorindex());
}
}
}
the code changes the colour, but when a refresh happens, the old colours are still used. what am i doing wrong?
anton heymann
refresh where? in your application using dd rendering? maybe graphic cache is used and is not updated.
sergey slezkin
quote:
originally posted by sergey slezkin
refresh where? in your application using dd rendering? maybe graphic cache is used and is not updated.
sergey
yes, i am using dd rendering. i am not sure how to refresh the cache. i do call some code in start-up :
m_pdevice = oddbgsmanager::setupactivelayoutviews(m_pdevice, this);
enablegsmodel(true);
anton heymann

an example of refreshing the cache is cdwgviewer::onviewerregen()
(dwgviewer.cpp, odamfcapp sample)
sincerely yours,
george udov

george
sorry - still not working. i have implemented the code change to refresh the cache, but it still does not change the colours. maybe i am missing something else. i also tried using enablegsmodel(false) - which i assume turns of caching.
i am running out of ideas here
regards
anton heymann
hi anton,
changing color of inserts affects only those entities within blocks whose color is "byblock".


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