adc 发表于 2013-12-30 13:02
这里处理完也只是找不到图层就不执行,我是希望列表中如果有图层不存在,其他图层也可以正常打开,能这样 ...
试试这个。。。- (defun c:tt()
- (slayon '("wall" "DJ灯具")))
- (defun slayon (lays / n obj)
- (vl-load-com)
- (if (listp lays)
- (foreach n lays
- (if (and (tblsearch "layer" n)
- (setq obj(vlax-ename->vla-object(tblobjname "layer" n))))
- (progn
- (vla-put-lock obj :vlax-false)
- (vla-put-layeron obj :vlax-true)
- (if (= (vla-get-Freeze obj) :vlax-True)
- (vla-put-Freeze obj :vlax-false))
- ) ;_ end of progn
- ) ;_ end of if
- ) ;_ end of foreach
- ) ;_ end of if
- ) ;_ end of defun
|