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:

nviewerregen()
(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".