;;打开所有
(defun c:LayerOnAll (/)
  (vlax-for la (vla-get-Layers *doc*) (vla-put-LayerOn la 1))
  (princ "\n打开所有图层操作完成!")
  (princ)
)
;;LayerUnLockAll解锁所有
(defun c:LayerUnLockAll	()
  (vlax-for la (vla-get-Layers *doc*) (vla-put-Lock la 0))
  (princ "\n解锁所有图层操作完成!")
  (princ)
)
;;解冻所有
(defun C:LayerFreeAll ()
  (vlax-for la (vla-get-Layers *doc*)
    (vl-catch-all-apply 'vla-put-Freeze (list la 0))
  )
  (princ "\n解冻所有图层操作完成!")
  (princ)
)
;;释放所有
(defun c:LayerAllF ()
  (c:LayerOnAll)
  (c:LayerUnLockAll)
  (c:LayerFreeAll)
)
;;;移至当前
(defun c:ToActiveLayer (/ ss)
  (setvar "cmdecho" 0)
  (if (setq ss (ssget))
    (command "chprop"
	     ss
	     ""
	     "la"
	     (getvar "clayer")
	     "color"
	     "bylayer"
	     "ltype"
	     "bylayer"
	     ""
    )
  )
  (princ)
)
;;;图层刷子
(defun c:LayerMatch (/ enp ss)
  (setvar "cmdecho" 0)
  (if (setq enp (entsel "\n选取来源图层的一个对象:"))
    (while (progn (princ "\n选取要刷的目标对像:")
		  (setq ss (ssget ":s"))
	   )
      (command "chprop"
	       ss
	       ""
	       "la"
	       (fsxm-getendxf (car enp) 8)
	       ""
      )
    )
  )
  (princ)
)