@Anonymous wrote:
....
How would I write a lisp to turn on all layers?
....
There's a native AutoCAD command LAYON that does that. If you need it in Lisp terms specifically, for some reason, this would do:
(command "_.layon")
But that won't turn on any Layers that are Frozen. If you might have those, and you want them thawed as well as turned on, you could use the LAA or LAON command [depending on whether you want any Locked Layers Unlocked, too] from my LayerAll.lsp collection [see what the different commands do in their descriptions:]
;;; LayerAll.lsp
;;; To perform operations On All Layers
(defun C:LAA (); Layers All All [Thawed, Unlocked, On]
(command "_.layer" "_thaw" "*" "_unlock" "*" "_on" "*" "" "_.regen")
(princ)
)
(defun C:LAON (); Layers All [Thawed and] On [not Unlocked]
(command "_.layer" "_thaw" "*" "_on" "*" "" "_.regen")
(princ)
)
(defun C:LAOF (); Layers All Off [except current]
(command "_.layer" "_off" "*" "_no" "")
(princ)
)
(defun C:LAF (); Layers All Frozen [except current]
(command "_.layer" "_freeze" "*" "_no" "")
(princ)
)
Kent Cooper, AIA