Reading Line color

Use this forum to ask questions about how to do things in dxflib.

Moderator: andrew

Post Reply
Registered Member
Posts: 2
Joined: Sun Jul 19, 2015 11:07 am

Reading Line color

Post by RobinCris » Mon Aug 31, 2015 4:31 am

I am reading dxf file and I do only 2D drawings.
I use polylines to draw a flat. On top of the polylines I draw lines (represent windows).
Because I am missing dimension, I was looking for a way to represent the window height.
I decided to use the color RGB system and to set the RED value of the line to the height. use the name of the color too.
so the colors will be 130,0,255 or 215,0,255 etc.
I do it in autocad.

The problem is that I can't find it when I read the dxf file

Please help

User avatar
Site Admin
Posts: 6160
Joined: Fri Mar 30, 2007 6:07 am

Re: Reading Line color

Post by andrew » Mon Aug 31, 2015 8:36 am

You can access the entity color as part of the member variable 'attributes' of your DL_CreationInterface implementation:
void MyClass::addLine(const DL_LineData& data) {
    int col = attributes.getColor24();
    int r = (col&0x00ff0000) >> 16;
    int g = (num&0x0000ff00) >> 8;
    int b = (num&0x000000ff);

Post Reply

Return to “dxflib 'How Do I' Questions”