can somebody help me to modify a lisp i found at cadalyst. This is useful but after issuing the command and the routine thawing the drawing, if the user accidentally hits escape key, it does not revert back to its old state and shows all the frozen layers. Maybe an error tap will solve this but am not that good at that...
here's the code :
;;;========================================================================
;;; *** LYR-UNHIDE.LSP ***
;;;========================================================================
;;;
;;; This function dynamicaly "TURN ON" frozen layers by selecting objects
;;; lying on these layers. The procedure is achieved by temporary turning
;;; on all layers to enable selection.
;;;
;;;
;;; "Specially recommanded to use on Xrefs" - Raymond Rizkallah, Aug. 2007
;;;========================================================================
(defun C:LUH (/ entsll laynam laypmt )
(setq orgm (getvar "regenmode"))
(setq laylst nil laypmt " ")
(command "undo" "m" "undo" "g")
(setvar "regenmode" 1)
(command "layer" "t" "*" "on" "*" "")
(while
(setq entsll (nentsel "\n Select object on layer to be unhidden: "))
(setq laynam (cdr (assoc 8 (entget (car entsll)))))
(if (null laylst) (setq laylst (strcat laynam ",")) (setq laylst (strcat laylst laynam ",")))
;(prompt (strcat "\n <" (substr laylst 1 (1- (strlen laylst))) ">"))
(setq laypmt (strcat laypmt "<" laynam "> ; ")) (prompt (strcat "\n" laypmt))
) ;end while
; (command "undo" "end" "undo" "1")
(if laylst (command "layer" "t" laylst "on" laylst "u" laylst "")) ;end if
(setvar "regenmode" orgm)
(princ)
) ;end function
;;;========================================================================
(prompt "\n Use [C:LUH] to dynamicaly reveal hidden layers. ")
(princ)