Try this:
(defun c:foo ( / accm c ly nm)
(setq accm
(vla-getinterfaceobject (vlax-get-acad-object)
(strcat "AutoCAD.AcCmColor." (substr (getvar 'ACADVER) 1 2))
)
)
(while
(setq ly (tblnext "layer" (not ly)))
(and
(wcmatch (setq nm (cdr (assoc 2 ly))) "~*|*")
(setq c (cdr (assoc 62 ly)))
(progn
(vla-put-ColorIndex accm c)
(entmod
(append
(entget (tblobjname "layer" nm))
(list
(cons 420
(apply 'LM:RGB->True
(mapcar
'vlax-get-property
(list accm accm accm)
'(red green blue)
)
)
)
)
)
)
)
)
)
(vlax-release-object accm)
(princ)
)
;; RGB -> True - Lee Mac 2011
;; Args: r,g,b - Red,Green,Blue values
(defun LM:RGB->True (r g b)
(+
(lsh (fix r) 16)
(lsh (fix g) 8)
(fix b)
)
)