This will asks user to select a block.
Ask what color they want.
Display what layers are used by the block with temp dcl file
let the user select they layers they want to change.
Change layers selected with the color selected
loop until canceled.
Will display error if selecting anything other then a block.
"Object is not a block. "
Combined these lisps
https://forums.augi.com/showthread.php?18929-Block-layer-Lisp-Finder
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-do-i-display-a-list-of-layers-in-a-dcl-list-box/td-p/9454310
;;----------------------------------------------------------------------------;;
;; Change Color of Layer Base on Block Selection
(defun C:BBL (/ blk tlist ename llist Color)
(while (setq blk (car (entsel "\nSelect a block: ")))
(if (= (cdr (assoc 0 (entget blk))) "INSERT")
(progn
(setq tlist (tblsearch "BLOCK" (cdr (assoc 2 (entget blk))))
ename (cdr (assoc -2 tlist))
)
(while ename
(if(not(member(cdr (assoc 8 (entget ename)))llist))
(setq llist (append (list (cdr (assoc 8 (entget ename)))) llist))
)
(setq ename (entnext ename))
)
(setq llist (vl-sort llist '<))
(prompt "\nPick New Layer Color:")
(setq Color (acad_colordlg 1))
(setq LayLst (AT:ListSelect "Select Layers to Change Color" "Layer Names" 30 60 "true" llist))
(setvar 'cmdecho 0)
(foreach x LayLst
(vl-cmdf "-Layer" "C" Color x "")
)
(setvar 'cmdecho 1)
(setq llist nil)
)
(princ "\nObject is not a block ")
)
)
(princ)
)
;; List Select Dialog (Temp DCL list box selection, based on provided list)
;; title - list box title
;; label - label for list box
;; height - height of box
;; width - width of box
;; multi - selection method ["true": multiple, "false": single]
;; lst - list of strings to place in list box
;; Alan J. Thompson, 09.23.08 / 05.17.10 (rewrite)
(defun AT:ListSelect (title label height width multi lst / fn fo d f)
(setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w"))
(foreach x (list (strcat "list_select : dialog { label = \"" title "\"; spacer;")
(strcat ": list_box { label = \"" label "\";" "key = \"lst\";")
(strcat "allow_accept = true; height = " (vl-princ-to-string height) ";")
(strcat "width = " (vl-princ-to-string width) ";")
(strcat "multiple_select = " multi "; } spacer; ok_cancel; }")
)
(write-line x fo)
)
(close fo)
(new_dialog "list_select" (setq d (load_dialog fn)))
(start_list "lst")
(mapcar (function add_list) lst)
(end_list)
(setq item (set_tile "lst" "0"))
(action_tile "lst" "(setq item $value)")
(setq f (start_dialog))
(unload_dialog d)
(vl-file-delete fn)
(if (= f 1)
((lambda (s / i s l)
(while (setq i (vl-string-search " " s))
(setq l (cons (nth (atoi (substr s 1 i)) lst) l))
(setq s (substr s (+ 2 i)))
)
(reverse (cons (nth (atoi s) lst) l))
)
item
)
)
)