高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】object colors
object colors
object colors
hello,
i've found some threads on object color topic - but
didn't find out an answer to my problem.
i'm looking for a color of an entity; there's a method
odcmcolor colorindex(), but it always returns 256.
where can i find the table of all colors, to find the
color pointed by this index?
thanks in advance for your help
ps : i'm using macos x
color 256 indicates color is bylayer.
static oduint32 odcmentitycolor::lookuprgb(oduint8 colorindex)
looks up the rgb value of colorindex. the low byte is blue, the next byte is green, and the third byte is red. the high byte is the color method.
0 and 256 are special values.
0 indicates byblock color. if it's not in a block definition, it will be displayed as though its color was 7.
256 indicates bylayer color, and the entity uses the color of the layer that it's on.
why?
i try to read dwg file. colorindex = 256, i use static oduint32 odcmentitycolor::lookuprgb(oduint8 colorindex) to get grb color, but the value return is 0, 0, 0. please teach me.
tks a lot.
best regards!
tuan nq
if you have an entity and by layer, you can do this:
oddbentityptr pent /*... recieved in some way*/
if (color is by layer) {
oddblayertablerecordptr player = pent->layerid().safeopenobject();
player->color() or player->colorindex() should have the right color now.
}
however, the situation is more complex when you have an entity in a block reference, and there is a bad mesh with byblock, bylayer and the 0 layer there.
hope this helps.
regards
chudomir
thanks!
it works fine!
thanks a lot, chudomir!
best regrads!
tuan nq
|