View Full Version : AutoCAD Color Index: Index Color List
GreenMan415
2008-06-24, 02:31 PM
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
Apparently, Bentley has worked one up (http://209.85.215.104/search?q=cache:jbkSvtEJcyEJ:discussion.bentley.com/cgi-bin/dnewsweb.exe/autocad_rgb.pdf%3Fuucount%3D1%26cmd%3Darticle%26group%3Dbentley.microstation.v8.general%26item%3D3564%26part%3D100%26utag%3D%26/autocad_rgb.pdf+rgb+values+for+aci&hl=en&ct=clnk&cd=1&gl=us).
GreenMan415
2008-06-24, 02:40 PM
But that listing is wrong, I just check the first couple colors and the vaules are outdated.
But that listing is wrong, I just check the first couple colors and the vaules are outdated.
Then, how about this one (http://www.isctex.com/acadcolors.php)?
GreenMan415
2008-06-24, 03:40 PM
You are the best!
dzatto
2008-06-24, 04:00 PM
Don't tell him that. His head will get even bigger. :mrgreen:
GreenMan415
2008-06-24, 04:16 PM
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 :)
irneb
2008-06-25, 05:36 AM
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:
(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.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.