| 
执行state,可以对layer state进行保存、恢复、读入、输出、删除等操作。
×
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册 
    
 
  (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)
)
 
 |