Results 1 to 8 of 8

Thread: AutoCAD Color Index: Index Color List

  1. #1
    Active Member
    Join Date
    2007-02
    Posts
    72
    Login to Give a bone
    0

    Default AutoCAD Color Index: Index Color List

    Anyone know an easy way to export the AutoCAD Index Color Listing with associated colors or RGB values? We are trying to match our color tables to another CAD systems translatiion system.

    Thanks,

    -Bill

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: AutoCAD Color Index: Index Color List

    Apparently, Bentley has worked one up.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    Active Member
    Join Date
    2007-02
    Posts
    72
    Login to Give a bone
    0

    Default Re: AutoCAD Color Index: Index Color List

    But that listing is wrong, I just check the first couple colors and the vaules are outdated.

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: AutoCAD Color Index: Index Color List

    Quote Originally Posted by GreenMan415 View Post
    But that listing is wrong, I just check the first couple colors and the vaules are outdated.
    Then, how about this one?
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    Active Member
    Join Date
    2007-02
    Posts
    72
    Login to Give a bone
    0

    Default Re: AutoCAD Color Index: Index Color List

    You are the best!

  6. #6
    Certifiable AUGI Addict dzatto's Avatar
    Join Date
    2006-12
    Location
    Big "D"
    Posts
    3,711
    Login to Give a bone
    0

    Default Re: AutoCAD Color Index: Index Color List

    Don't tell him that. His head will get even bigger.

  7. #7
    Active Member
    Join Date
    2007-02
    Posts
    72
    Login to Give a bone
    0

    Default Re: AutoCAD Color Index: Index Color List

    I was searching the ACAD docs most of the morning and just started to look at the net so for him to find it, my hat goes off to him

  8. #8
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: AutoCAD Color Index: Index Color List

    Try this, it uses AutoCAD to translate its colour index to RGB - and can give the closest matching Colour Index (between 1 and 255) for any given RGB tuple:
    Code:
    (vl-load-com)
    (defun AC-CI-2-RGB (CI / obj RGB)
        ;; Get a color object from the current layer
        (setq obj (vlax-ename->vla-object (tblobjname "LAYER" (getvar "CLAYER"))))
        (setq obj (vla-get-TrueColor obj))
        (vla-put-ColorIndex obj CI)
        (setq RGB (list (vla-get-Red obj) (vla-get-Green obj) (vla-get-Blue obj)))
    )
    
    (defun RGB-2-AC-CI (RGB / obj CI)
        ;; Get a color object from the current layer
        (setq obj (vlax-ename->vla-object (tblobjname "LAYER" (getvar "CLAYER"))))
        (setq obj (vla-get-TrueColor obj))
        (vla-SetRGB obj (car RGB) (cadr RGB) (caddr RGB))
        (setq CI (vla-get-ColorIndex obj))
    )
    
    (defun Write-CI-RGB ($file / CI)
        (setq CI 1)
        (while (< CI 256)
            (if $file
                (write-line (strcat (itoa CI) " = " (vl-princ-to-string (AC-CI-2-RGB CI))) $file)
                (princ (strcat "\n" (itoa CI) " = " (vl-princ-to-string (AC-CI-2-RGB CI))))
            )
            (setq CI (1+ CI))
        )
    )
    Example use: type (Write-CI-RGB "c:\\AC-RGB.TXT") at the command line. It will then save all AC colours to a file, together with their RGB values in decimal 256 format.
    To get a particular colour index's RGB (e.g. 253) type (AC-CI-2-RGB 253) at the command line.It'll show the RGB value of (173 173 173).
    To get the closest matching CI of a RGB value type (RGB-2-AC-CI '(170 175 169)) at the command line.It'll show the CI value of 253, even though it's not exact it's the closest match.

Similar Threads

  1. AutoCAD Color Index (ACI) with RGB Equivalents
    By mooker16 in forum AutoCAD Civil 3D - General
    Replies: 3
    Last Post: 2020-03-06, 03:08 PM
  2. 2015: Need To Change A Color In The Color Index.
    By omorah in forum AutoCAD General
    Replies: 2
    Last Post: 2014-08-04, 11:43 AM
  3. AutoCAD Color Index and RGB
    By Kris.Keller in forum AutoCAD General
    Replies: 14
    Last Post: 2013-02-06, 07:28 AM
  4. autcad Color Index messed up
    By rjairath in forum AutoCAD General
    Replies: 6
    Last Post: 2008-02-25, 08:15 PM
  5. Index Color to RGB
    By bweir in forum Dot Net API
    Replies: 6
    Last Post: 2007-02-11, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •