DXF code for various colors

Discussion in 'AutoCAD' started by askoh, Sep 23, 2004.

  1. askoh

    askoh Guest

    I am parsing DXF files and would like to know the colors associated with the numbers in the file. The DXF reference manual just states
    Group code 62 means Color Number (fixed)
    But I cannot find what the Color Number equates to.

    Thanks in advance,
    Koh
    http://www.askoh.com
     
    askoh, Sep 23, 2004
    #1
  2. Look at COLORWH.dwg in the Sample folder.

    Also, bear in mind that any entity whose color is "Bylayer" will not have a
    Code 62 item in its association list. Only entities with an explicitly
    assigned color other than Bylayer get an (assoc 62) value assigned.

    Kent Cooper, AIA


    ...
     
    Kent Cooper, AIA, Sep 23, 2004
    #2
  3. askoh

    ecable Guest

    While an entities color will not show up if it is bylayer, color 256 is bylayer.
     
    ecable, Sep 24, 2004
    #3
  4. askoh

    askoh Guest

    Thanks for the responses to my question. Now that I know the color code visually, I am looking for the computer RGB values of those colors so that my program can parse the DXF and look the same color as in AutoCAD.

    Thanks in advanced,
    Koh
     
    askoh, Sep 30, 2004
    #4
  5. askoh

    BillZ Guest

    You can find functions to covert color types in:

    C:\Program Files\AutoCAD 2005\Sample\VisualLISP

    Color-util.lsp

    Heres one I had wrote to convert TrueColor to RGB:

    ;9/23/04 Bill Zondlo
    ;TrueColor to RGB converter.
    ;OLEnum is the 0 - 16777215 True Color positive number.
    ;
    ;
    (defun TrueColor-RGB (OLEnum / B G R)
    (cond ((and (>= OLEnum 0)
    (<= OLEnum 16777215))
    (setq R (/ OLEnum (* 256 256))
    G (- (/ OLEnum 256)(* 256 R))
    B (rem OLEnum 256)
    )
    (list R G B)
    )
    (t (prompt "\nNumber not within range of TrueColor."))
    ) ;end cond.
    )

    Bill
     
    BillZ, Oct 1, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.