本帖最后由 yjr111 于 2013-3-13 13:37 编辑
好像还不好搞,搞了一个多小时,惭愧,看看是不是需要的?
- (defun c:laman(/ ladict1 ladict n statenemelst num )
- (setq ladict1(vla-GetExtensionDictionary (vla-get-layers (vla-get-ActiveDocument (vlax-get-acad-object)))))
- (repeat (setq m(vla-get-count ladict1))
- (setq ladict(vla-item ladict1 (setq m(1- m))))
- (repeat (setq n(vla-get-count ladict))
- (setq statenemelst(cons (vla-get-name(vla-item ladict(setq n(1- n))))statenemelst))
- )
- )
- (xsdhk)
- (if num(command "layer" "a" "r" (nth (atoi num) statenemelst) "" "" ))
- (princ)
- )
- ;;;******************************************
- ;;;添加列表框内列表
- ;;;******************************************
- (defun adlst (key lst)
- (start_list key 3)
- (mapcar 'add_list lst)
- (end_list)
- )
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- (defun xsdhk (/ replace lsdcl fn dclid)
- (setq fn (open (setq lsdcl (VL-FILENAME-MKTEMP "tmp" "" ".dcl")) "w"))
- (foreach x
- '(" yyy : dialog{"
- " label="StateManager";"
- " :list_box{key="9";height=18;width=12;}"
- " :button{key="cancel";label="Cancel";is_cancel=true;width=1;height=2;}"
- "}"
- )
- (write-line x fn)
- )
- (close fn)
- (setq dclid (load_dialog lsdcl))
- (vl-file-delete lsdcl)
- (new_dialog "yyy" dclid "" screenpt)
- (adlst "9" statenemelst)
- (action_tile "9" "(setq num $value)(setq screenpt(done_dialog))")
- (start_dialog)
- (unload_dialog dclid)
- )
- (princ"\n图层状态简易切换,命令LAMAN.")
- (PRINC)
|