acet-layerp-mark
From AutoCad AutoLISP Functions
Places beginning and ending marks for Layer Previous recording
(acet-layerp-mark [status])
The acet-layerp-mark function allows you to group multiple layer commands into a single transaction so that they can be undone by issuing LAYERP a single time. LAYERPMODE must be on in order to set marks.
T if a begin mark is in effect; otherwise nil.
The following code changes layer 0 to blue, and then makes several additional layer changes between a set of begin and end marks. If you issue LAYERP after running this code, layer 0 reverts to blue.
(defun TestLayerP ()
;; Turn LAYERPMODE on, if it isn't already
(if (not (acet-layerp-mode))
(acet-layerp-mode T)
)
;; Set layer 0 to the color blue(command "_.layer" "_color" "blue" "0" "");; Set a begin mark(acet-layerp-mark T);; Issue a series of layer commands, and then set an end mark(command "_.layer" "_color" "green" "0" "")(command "_.layer" "_thaw" "*" "")(command "_.layer" "_unlock" "*" "")(command "_.layer" "_ltype" "hidden" "0" "")(command "_.layer" "_color" "red" "0" "");; Set an end mark(acet-layerp-mark nil))