Add the following code to your menu mnl or acaddoc.lsp.
Code:
;;; CurrentLayer checks and sets current layer.
;;; argument is name of layer to check.
;;; "prevlay" stores the name of the current layer
;;; to be reset later
(defun CurrentLayer (cl color /)
(if (tblsearch "LAYER" cl) ;check to see if desired layer exists
(progn ;if yes, then set to current
(setq oLay (vla-item (vla-get-layers *CurDoc*) cl))
(if (= (vlax-get-property oLay "Freeze") :vlax-True)
(vlax-put-property oLay "Freeze" :vlax-False)
)
(if (= (vlax-get-property oLay "LayerOn") :vlax-False)
(vlax-put-property oLay "LayerOn" :vlax-True)
)
(if (= (vlax-get-property oLay "Lock") :vlax-True)
(vlax-put-property oLay "Lock" :vlax-False)
)
(setq prevlay (getvar "clayer")) ;store current layer
(setvar "clayer" cl)
)
(progn ;else make new and set to current
(setq prevlay (getvar "clayer")) ;store current layer
(command "-layer" "make" cl "color" color "" "")
)
)
)
;;; RestorePrevLayer sets the current layer
;;; to the value stored in "prevlay"
(defun RestorePrevLayer ()
(setvar "clayer" prevlay)
)
Then, replace your menu macro with this: "^C^C(CurrentLayer "Dims" 82);_dimlinear;\\(RestorePrevLayer) ". Use whatever color number is standard for you.