改不如写。
话说楼主用vlisp开关图层,vl-cmdf不需要用。
- ;;图层反向开关 LST图层列表 如果开则关,关则开
- ;;code by edata @mjtd.com 2014-8-4
- (defun sk_layon&off(lst / a en sk_col)
- (if(=(type lst) 'LIST)
- (while(setq a(car lst))
- (if(and(= (type a) 'STR)(setq en(tblobjname "layer" a)))
- (progn
- (setq elist(entget en))
- (setq sk_col(cdr(assoc 62 elist)))
- (setq sk_col (* sk_col -1))
- (entmod(subst(cons 62 sk_col)(assoc 62 elist)elist))
- )
- )
- (setq lst(cdr lst))
- )
- )
- )
- ;;图层开关 LST图层列表 on&off=T为开 nil为关
- ;;code by edata @mjtd.com 2014-8-4
- (defun sk_layon(lst on&off / a en sk_col)
- (if(=(type lst) 'LIST)
- (while(setq a(car lst))
- (if(and(= (type a) 'STR)(setq en(tblobjname "layer" a)))
- (progn
- (setq elist(entget en))
- (setq sk_col(cdr(assoc 62 elist)))
- (if ((if on&off < >) sk_col 0)
- (progn
- (setq sk_col (* sk_col -1))
- (entmod(subst(cons 62 sk_col)(assoc 62 elist)elist))
- )
- )
- (entmod(subst(cons 62 sk_col)(assoc 62 elist)elist))
- )
- )
- (setq lst(cdr lst))
- )
- )
- )
- (defun c:tt(/ lst)
- (setq lst '("0" "layer1" "layer2" "layer3" "layer4" "layer5" "layer6" "layer7" "layer8" "layer10" "layer11" "layer12"))
- ;(sk_layon&off lst);;图层反向开关 LST图层列表 如果开则关,关则开
- (sk_layon lst nil);;图层开关 LST图层列表 on&off=T为开 nil为关
- (princ)
- )
-
|