查看单个帖子
旧 2009-05-05, 09:50 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】error with colors

error with colors
error with colors
does somebody tell me what's the problem with this code?
odcmcolor col;
col.setcolormethod( odcmentitycolor::kbylayer );
col.setcolor( mystructure.color().rgb() );
i'm trying to export my own structures to dwg/dxf files. but the program has a runtime error in the setcolor operation. i don't know why. could somebody help me?
thanks in advance.
what type and value does your mystructure.color().rgb() return?
sergey slezkin
sorry, i've forgotten to put this information. the operation rgb() returns an unsigned int.
1. if the int is 32-bit setcolor() expects higher byte representing colormethod and the rest 3 bytes - rgb or index depending on the color method. some combinations are invalid. for example color method kbyaci (autocad color index) and index value > 256.
2. setcolor() sets color method too so previous line is senseless.
3. if color method is kbylayer rgb can't be specified.
to set rgb value use setrgb(). but this function will set color method to kbycolor.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)