图层锁定vlisp函数高版本图元自动淡色显示
(defun c:tt(/ obj) (sk_layerLock (getvar "clayer") nil) (princ) ) ;;;name:sk_layerLock ;;;desc:LayerLock图层锁定 ;;;arg:layername 图层名 flag 锁定标志[t锁定或nil解锁] ;;;return:none 无 ;;;example:(sk_layerLock "0" t) ;;;date:2017-7-28 23:02:13 (defun sk_layerLock(layername flag / obj en) (if (setq en (tblobjname "layer" layername)) (progn (setq obj(vlax-ename->vla-object en)) (if flag (vla-put-lock obj :vlax-true) (vla-put-lock obj :vlax-false) ) (vla-put-layeron obj (vla-get-layeron obj)) (vla-regen (vla-get-activedocument(vlax-get-acad-object)) 1) (vlax-release-object obj) ) ) )