;;Changes selected object layer to a true color
;;of chose from a dialog
;; Created by: Jason Rhymes
;; Saved from: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-color-to-true-color-color-books-by-picking-an-object-from/td-p/2431036
box
(defun c:slt (/ ent ent_data rgb str objlay)

(setq ent
(entsel)
)

(setq ent_data
(entget
(car ent)

)
)
(setq rgb

(TrueColor-split
(cdr (assoc
420

(acad_truecolordlg
'(420 .
16711680)

)
)
)
)
)

(setq str
(strcat
(rtos (car rgb) 2
0)
","
(rtos (cadr rgb) 2
0)
","
(rtos (caddr rgb) 2
0)
)
)
(setq objlay

(cdr
(assoc 8 ent_data)
)
)

(command "layer" "Color" "T" str objlay "")
)
(defun TrueColor-split (c
/)
(list (lsh (fix c) -16)
(lsh (lsh (fix c) 16)
-24)
(lsh (lsh (fix c) 24) -24)

)
)
(c:slt)

Advertisements