by Fenton Webb
Here’s how to obtain the RGB value from an already AcDb::kOpenForRead AcDbEntity.
static COLORREF GetRGBFromEntity( AcDbEntity *ent ) { COLORREF colorRef = RGB(255, 255, 255); AcCmColor Color = ent->color(); AcCmEntityColor::ColorMethod ColorMethod = Color.colorMethod(); switch(ColorMethod) { case AcCmEntityColor::kByACI: { long acirgb, r,g,b; acirgb = AcCmEntityColor::lookUpRGB(Color.colorIndex()); b = ( acirgb & 0xff00L ); g = ( acirgb & 0xff00L ) >> 8; r = acirgb >> 16; colorRef = RGB( r, g, b); break; } }
return colorRef; }

Leave a Reply