Anyone have any good layer state routines, or comments to mine.
Layer states named after layout tab name:
(defun C:State (/ tmp)
(initget "I X S R D")
(setq tmp (getkword "\n* Layer States: [Import eXport - Save Restore - Delete]"))
(initget 7)
(cond ((= tmp "I")(LSImportIT))
((= tmp "X")(LSXportIT))
((= tmp "S")(LSSaveIT))
((= tmp "R")(LSRestoreIT))
((= tmp "D")(LSDeleteIT)))
(princ)
)
;;;
(defun ARCH:State (/ tmp)
(setq tmp (layerstate-has (getvar "ctab")))
(if (= tmp T)(LSRestoreIT))
(princ)
)
;;;
(ARCH:State);place in your acaddoc file
(defun LSImportIT (/ tmp)
(setq tmp (strcat (getvar 'dwgprefix)(vl-string-right-trim ".dwg" (getvar 'dwgname)) " ctab-" (getvar "ctab") ".las"))
(if (/= tmp nil)
(progn
(princ (strcat "\n* Importing LayerStates to: " tmp))
(command "mspace")
(layerstate-import tmp)
(command "pspace")
)
)
(princ))
;;;
(defun LSXportIT (/ tmp)
(setq tmp (strcat (getvar 'dwgprefix)(vl-string-right-trim ".dwg" (getvar 'dwgname)) " ctab-" (getvar "ctab") ".las"))
(princ (strcat "\n* Exporting Layer States to: " tmp))
(command "mspace")
(layerstate-export (getvar "ctab") tmp)
(command "pspace")
(princ))
;;;
(defun LSSaveIT ()
(princ (strcat "\n* Saving New Layer States to: " (getvar "ctab")))
(command "mspace")
(layerstate-save (getvar "ctab") 255 nil)
(command "pspace")
(princ))
;;;
(defun LSRestoreIT ()
(princ (strcat "\n* Restoring Layer States from: " (getvar "ctab")))
(command "mspace")
(layerstate-restore (getvar "ctab") nil 255)
(command "pspace")
(princ))
;;;
(defun LSDeleteIT ()
(princ (strcat "\n* Deleting Layer States from: " (getvar "ctab")))
(command "mspace")
(layerstate-delete (getvar "ctab"))
(command "pspace")
(princ))
Gary