Copy this version, put into a command definition:
(defun C:WHATEVER (/ ss n ent edata)
(if (setq ss (ssget "_I")); there's a selection
(repeat (setq n (sslength ss)); then
(setq
ent (ssname ss (setq n (1- n)))
edata (entget ent)
); setq
(entmod
(append
edata
(list (assoc 6 (tblsearch "layer" (cdr (assoc 8 edata))))); linetype of its Layer
'((62 . 256)); color ByLayer
(list (cons 8 (getvar 'clayer))); put on current Layer
); append
); entmod
); repeat
); if
(prin1)
)
Paste it into a plain-text editor such as Notepad. Change WHATEVER to a command name that will be meaningful to you. Save it to a file with a .lsp filetype ending.
In a drawing, use the APPLOAD command, navigate to where you saved it, and Load it.
As written [because that was the context in Message 1], it requires you to SELECT OBJECTS FIRST, then enter the command name. If you prefer, it could be modified to not require pre-selection of objects, but to permit that but also let you enter the command name first and then be asked to select objects.
Kent Cooper, AIA