This will create layerstate lsname if there isn't one and turn all layers on & thawed.
Otherwize it will restore then delete the layer state:
Code:
(defun c:LayAll (/ CMD lsname) (setq CMD (getvar "Cmdecho"))
(setvar "Cmdecho" 0)
(setq lsname "Off_or_Frozen")
(if (layerstate-has lsname)
(progn
(layerstate-restore lsname nil nil)
(princ "\nOff or Frozen layers restored")
(layerstate-delete lsname)
)
(progn
(layerstate-save lsname nil nil)
(command "layon" "laythw")
; (command "vplayer" "t" "*" "Current" "")
)
)
(setvar "Cmdecho" CMD)
(princ)
)
Macro to toggle all the layers visible:
Code:
^C^C^P(or C:LayAll (load "LayAll.lsp"));LayAll
- - - Updated - - -
Originally Posted by
rbdome
Version 2018. Attached is the Layer States Manager Dialog- After you create a Named Layer State, Click Clear All Button, then check only those Layer properties you want to restore for that Named Layer State. Then click the Update Button. You can do this in prior AutoCAD versions, although the Update button was referred to as the Save button prior to ACAD 2018.
As you didn't want to use the Layer States Manager Dialog to restore the layers that doesn't really help. All the properties are still saved in the layer state. Lots of ways to do this just not using layer state commands or lisp functions.