描述:图层锁定后自动暗显图层,解锁后恢复原来颜色
技术关键:LAYLOCKFADECTL 变量
- (defun c:hglayerlocksingle(/ lay tof layobj oldLAYLOCKFADECTL)
- (defun tof(msg / )
- (if(= msg :vlax-true)
- (progn
- (setvar "LAYLOCKFADECTL" -90)
- (setq msg :vlax-false)
- )
- (progn
- (setvar "LAYLOCKFADECTL" 90)
- (setq msg :vlax-true)
- )
- )
- )
- (setq oldLAYLOCKFADECTL (getvar "LAYLOCKFADECTL"))
-
- (setq lay (cdr (assoc 8 (entget(car(entsel "\n选择需更改图层锁定状态的图元"))))))
- (setq layobj (vlax-ename->vla-object (tblobjname "layer" lay)))
- (vla-put-lock layobj (tof(vla-get-Lock layobj)))
-
- (setvar "LAYLOCKFADECTL" oldLAYLOCKFADECTL)
- (princ)
- )
参考帖子:
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=69187&extra=&highlight=%CB%F8%B6%A8%2B%B0%B5&page=1 http://bbs.mjtd.com/thread-83744-1-1.html
|