迈总面板问题(求帮修改)
原帖地址:简单的自定面板函数 - AutoLISP/Visual LISP 编程技术 - AutoCAD论坛 - 明经CAD社区 - Powered by Discuz! (mjtd.com)
启动面板 点击使用一个命令后,点击空格启动的是面板,请问能否修改成 空格重复上次的命令不启动面板。
请大神帮忙修改一下 谢谢!
[*](defun c:Da ()
[*](mai_make_panel
[*] (list
[*] (list "测试"
[*] (list "测试A1" "DaMo_GD_ZNSX")
[*] (list "测试A2" "DaMo_GD_PMFH")
[*] (list "测试A3" "DaMo_GD_JYST")
[*] )
[*] (list ""
[*] (list "测试B1" "DaMo_GD_DTBL")
[*] (list "测试B2" "DaMo_GD_ZHDQ")
[*] (list "测试B3" "DaMo_GD_DQXZ")
[*] )
[*] (list ""
[*] (list "测试C1" "DaMo_GD_GYZJ")
[*] (list "测试C2" "DaMo_GD_DXFX")
[*] (list "测试C3" "DaMo_GD_PLDQ")
[*] )
[*] )
[*])
[*](princ)
[*])
[*](defun mai_make_panel (menulist / m n nn nnn menuname val_lst tt order_lst)
[*](defun add_dclrow (dstr) (if dstr (setq val_lst (cons dstr val_lst)) ))
[*](add_dclrow "curbutton : button{width=10;vertical_margin=none;vertical_margin=none;}")
[*](add_dclrow "curpanel : dialog{label=\"迷你自定义面板\";alignment=centered;vertical_margin=none;horizontal_margin=none;")
[*](add_dclrow ":row{")
[*](setqlen (apply 'max (mapcar 'length menulist))
[*] order_lst (apply 'append (mapcar 'cdr menulist))
[*] n 0
[*] m 0
[*])
[*](foreach nn menulist
[*] (add_dclrow (strcat " : boxed_column{label=\"" (car nn) "\";vertical_margin=none; horizontal_margin=none;") )
[*] (foreach nnn (cdr nn)
[*] (setq n(1+ n)
[*] tt (car nnn)
[*] tt (if tt
[*] tt
[*] ""
[*] )
[*] )
[*] (add_dclrow (strcat " : curbutton{key=\"but" (vl-princ-to-string n) "\";label=\"" tt "\";}")))
[*] (repeat (- len (length nn))
[*] (setq m (1+ m))
[*] (add_dclrow (strcat " : curbutton{key=\"butno" (vl-princ-to-string m) "\";}")) )
[*] (add_dclrow "}")
[*])
[*](add_dclrow "}:button{label=\"退出\";key=\"cancel\";is_cancel=true;width=20;height=2.5;fixed_width=true;alignment=centered;}}")
[*](setq menuname (vl-filename-mktemp "temp_pannel.dcl"))
[*](setq nn (open menuname "w"))
[*](foreach n (reverse val_lst) (write-line n nn))
[*](close nn)
[*](setq nnn (load_dialog menuname))
[*](vl-file-delete menuname)
[*](if (not (new_dialog "curpanel" nnn))
[*] (exit)
[*])
[*](setq n 0)
[*](repeat m (mode_tile (strcat "butno" (vl-princ-to-string m)) 1) (setq m (1- m)))
[*](foreach nn menulist
[*] (foreach nnn (cdr nn)
[*] (setq n(1+ n)
[*] tt (car nnn)
[*] tt (if tt
[*] tt
[*] ""
[*] )
[*] )
[*] (if (= tt "")
[*] (mode_tile (strcat "but" (vl-princ-to-string n)) 1)
[*] (action_tile
[*] (strcat "but" (vl-princ-to-string n))
[*] (strcat "(done_dialog " (vl-princ-to-string n) ")")
[*] )
[*] )
[*] )
[*])
[*](setq nn (start_dialog))
[*](unload_dialog nnn)
[*](if (> nn 0)
[*] (progn (setq tt (cadr (nth (1- nn) order_lst)))
[*] (if (= (eval (read (strcat "(type c:" tt ")"))) 'SUBR)
[*] (progn (princ "\n")
[*] (eval (read (strcat "(c:" tt ")")))
[*] )
[*] (progn
[*] (princ "\n")
[*] (vla-SendCommand (vla-get-ActiveDocument(vlax-get-acad-object)) (strcat tt "\n"))
[*] )
[*] )
[*] )
[*])
[*])
[*](princ)
记得论坛有人求救过,是定义一个按键重复上一次命令。自己搜下
[*] (progn (setq tt (cadr (nth (1- nn) order_lst)))
[*] (eval(read (strcat "(defun c:q()(Vlax-Invoke-Method (Vlax-Get (Vlax-Get-Acad-Object)
[*]'ActiveDocument) 'SendCommand (strcat \"" tt "\" \" \"))(princ)))")));自定义q为重复上次命令
[*] (vla-SendCommand (vla-get-ActiveDocument(vlax-get-acad-object)) (strcat tt "\n"))
[*] )
liunian0524 发表于 2022-7-22 08:02
记得论坛有人求救过,是定义一个按键重复上一次命令。自己搜下
[*] (progn (setq tt (cadr (nth ( ...
谢谢你的回复!!! 谢谢分享,. 我从论坛里下载迈总面板就是已改好的。 空格直接重复上次命令
页:
[1]