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

yang686526 2009-05-05 09:50 AM

【转帖】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


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