|  (defun c:tt(/ stb makedcl layonoff lst- dcl lys lysoff lys on ctl a)
  (Defun STB(TAB / snl sll)
    (SetQ snl '()sll (TblNext TAB T))
    (While (SetQ snl (Cons (Cdr (Assoc 2 sll)) snl)sll (TblNext TAB nil)))
    (vl-sort (vl-remove'nil snl)'<))
  (defun makedcl(str_lst / dclfile fileID dclHandle)
    (setq  dclfile(vl-filename-mktemp nil nil ".dcl")fileID(open dclfile "w"))
    (cond((= (type str_lst) 'str)(write-line str_lst fileID))
   ((= (type str_lst) 'list)(foreach n str_lst (write-line n fileID))))
    (close fileID)
    (setq dclHandle(load_dialog dclfile))
    (vl-file-delete dclfile)
    dclHandle)
  (defun layonoff(la onoff / co)
    (setq la(entget(TBLOBJNAME"layer" la))co(assoc 62 la))
    (entmod(subst(cons 62(if onoff(abs(cdr co))(- 0(abs(cdr co)))))co la)))
  (defun getvalue()
    (foreach x(read(strcat"("(get_tile"on")")"))(layonoff(nth x lysoff)t))
    (foreach x(read(strcat"("(get_tile"off")")"))(layonoff(nth x lyson)nil)))
  (defun lst-(lst lst1)
    (foreach x lst1(setq lst(vl-remove x lst)))lst)
  (setq  lys(stb"LAYER")ctl 3)
  (while(> ctl 0)
    (setq lysoff(vl-remove'nil(mapcar'(lambda(x)(if(<(cdr(assoc 62(tblsearch"layer"x)))0)x))lys))
    lyson(LST- lys lysoff)
    dcl(makedcl(list"LAYLIST:dialog{ label=\"~开关图层~\";:boxed_column{:row{"
         (strcat":list_box{label=\"可关闭图层\";key=\"off\";fixed_width=8;height="
          (itoa(+(max(length lysoff)(length lyson))2))";multiple_select = true;}")
         ":list_box{label=\"可打开图层\";key=\"on\";fixed_width=8;height=1;multiple_select = true;}}"
         ":row{:button{key=\"GO\";label=\"执行\";}:button{key=\"ESC\";label=\"退出\";is_cancel=true;}}}}")))
    (new_dialog "LAYLIST" dcl)
    (start_list"on")(mapcar 'add_list lysoff)(end_list)
    (start_list"off")(mapcar 'add_list lyson)(end_list)
    (action_tile "GO""(getvalue)(done_dialog 1)")
    (action_tile"ESC""(done_dialog 0)")
    (setq ctl(start_dialog))
    (unload_dialog dcl)))
 纯属好玩,没多大实际上用处, 我自己这么觉得
 
 |