ljwsyzf
发表于 2018-1-14 20:07:47
edata 发表于 2018-1-14 13:29
关键就是下面两句。
多谢大神指点,能行了。:handshake
ljwsyzf
发表于 2018-1-14 20:09:05
ㄘ丶转裑ㄧ灬 发表于 2018-1-14 17:08
((= re 101) (vla-sendcommand(vla-get-activedocument(vlax-get-acad-object))(strcat "HT_101 ")))
http ...
哈哈,谢谢啊。你的这个面板也很优秀,就是我太菜了,简单的面板我能看的懂。
casd
发表于 2018-1-17 08:40:07
edata 发表于 2018-1-14 13:29
关键就是下面两句。
非常方便,再请教一下,autool有个功能就算固定一个命令重复面板调用的命令。比如q,也可以重复面板调用的命令,如何实现
edata
发表于 2018-1-17 12:31:57
casd 发表于 2018-1-17 08:40
非常方便,再请教一下,autool有个功能就算固定一个命令重复面板调用的命令。比如q,也可以重复面板调用 ...
方法有很多。。。
比如这一种。
;修改版,向飞诗学习
(defun c:xxx ()
(mai_make_panel
(list
(list "梁"
(list "画 梁" "circle") ;(list按钮标签运行的命令)
(list "单线变梁" "mini_line_to_beam")
(list "筏板梁倒角" "mini_foundation_beam")
(list "修补梁柱" "mini_fix_beam")
(list "修补双线" "mini_fix_dline")
(list "框选修补线" "mini_fix_line")
) ;_ 结束list
(list "柱"
(list " + 型柱" "mini_c_column")
(list " L 型柱" "mini_l_column")
(list " T 型柱" "mini_t_column")
(list " ○ 型柱" "mini_O_column")
(list " □ 型柱" "mini_r_column")
(list "轴线布柱" "mini_axis_column")
(list "填 充 柱" "mini_fill_column")
(list "墙体填充" "mini_fill_wall")
(list "转PKPM GS柱" "mini_pline_to_beam")
(list "多线变柱" "mini_pline_to_column")
) ;_ 结束list
) ;_ 结束list
) ;_ 结束mai_mak_panel
(princ)
)
(defun mai_make_panel ( menulist / n num_nobut num_button nn nnn menuname val_lst add_dclrow tt order_lst in num_image)
(defun add_dclrow ( dstr / ) (if dstr (setq val_lst (cons dstr val_lst))))
(setq menuname (strcat (vl-filename-mktemp) "temp_pannel.dcl"))
(add_dclrow "curbutton:button{width=10;vertical_margin=none;vertical_margin=none;}")
(add_dclrow "curimage:image{width=10;height=0.2;vertical_margin=none;vertical_margin=none;}")
(add_dclrow "curpanel:dialog{label=\"迷你自定义面板\";alignment=centered;vertical_margin=none;horizontal_margin=none;")
(add_dclrow ":row{")
(setq len (apply 'max (mapcar 'length menulist))
order_lst (apply 'append (mapcar 'cdr menulist))
num_button 0
num_nobut 0
in 0
num_image 0
)
(foreach nn menulist
(setq in 0)
(add_dclrow (strcat " : boxed_column{label=\"" (car nn) "\";vertical_margin=none; horizontal_margin=none;"))
(foreach nnn (cdr nn)
(setq num_button (1+ num_button)
in (1+ in)
num_image (1+ num_image)
tt (car nnn)
tt (if tt tt "")
)
(add_dclrow (strcat ":curbutton{label=\"" tt "\";key=\"but" (itoa num_button) "\";}"))
(if (= 4 in)
(progn (add_dclrow (strcat ":curimage{key=\"ima" (itoa num_image) "\";color=18;}"))
(setq in 0)
)
)
)
(repeat (- len (length nn))
(setq num_nobut (1+ num_nobut)
in (1+ in)
num_image (1+ num_image)
)
(add_dclrow (strcat " : curbutton{key=\"butno" (itoa num_nobut) "\";color=-2;}"))
(if (= 4 in)
(progn (add_dclrow (strcat ":curimage{key=\"ima" (itoa num_image) "\";}"))
(setq in 0)
)
)
)
(add_dclrow "spacer;}")
)
(add_dclrow "}:button{label=\"关闭\";key=\"cancel\";is_cancel=true;width=10;fixed_width=true;alignment=centered;}}")
(vl-file-delete menuname)
(setq nn (open menuname "w"))
(foreach n (reverse val_lst) (write-line n nn))
(close nn)
(setq nnn (load_dialog menuname))
(if (not (new_dialog "curpanel" nnn)) (exit))
(setq n 0)
(repeat num_nobut (mode_tile (strcat "butno" (itoa num_nobut)) 1) (setq num_nobut (1- num_nobut)))
(foreach nn menulist
(foreach nnn (cdr nn)
(setq n (1+ n)
tt (car nnn)
tt (if tt tt "")
)
(if (= tt "")
(mode_tile (strcat "but" (itoa n)) 1)
(action_tile (strcat "but" (itoa n)) (strcat "\(done_dialog " (itoa n) "\)"))
)
)
)
(setq nn (start_dialog))
(unload_dialog nnn)
(vl-file-delete menuname)
(if (> nn 0)
(progn (setq tt (cadr (nth (1- nn) order_lst)))
(princ "\n")
(eval(read (strcat "(defun c:q()(Vlax-Invoke-Method (Vlax-Get (Vlax-Get-Acad-Object) 'ActiveDocument) 'SendCommand (strcat \"" tt "\" \" \"))))")))
(Vlax-Invoke-Method (Vlax-Get (Vlax-Get-Acad-Object) 'ActiveDocument) 'SendCommand (strcat tt " "))
;(Vlax-Invoke-Method (Vlax-Get-Or-Create-Object "WScript.Shell" ) 'Sendkeys (strcat tt "{Enter}"))
)
)
)
casd
发表于 2018-1-17 15:57:39
,万分感谢
liunian0524
发表于 2018-1-18 11:29:39
我觉得CAD选项里面-用户系统配置--取消勾选绘图区域中使用快捷键菜单.
直接鼠标右键就可以重复上一次命令,
casd
发表于 2018-1-19 10:19:49
liunian0524 发表于 2018-1-18 11:29
我觉得CAD选项里面-用户系统配置--取消勾选绘图区域中使用快捷键菜单.
直接鼠标右键就可以重复上一次命令, ...
你可能是cad初学者,还要继续努力
liunian0524
发表于 2018-1-19 10:22:29
casd 发表于 2018-1-19 10:19
你可能是cad初学者,还要继续努力
对,我是lsp初学者
clinber
发表于 2018-1-19 12:50:12
liunian0524 发表于 2018-1-19 10:22
对,我是lsp初学者
楼主要求是重复面板里面上一次点击的命令 不是重复弹出面板的命令
liunian0524
发表于 2018-1-19 14:32:28
clinber 发表于 2018-1-19 12:50
楼主要求是重复面板里面上一次点击的命令 不是重复弹出面板的命令
明白,如果面板不是点击,是直接输入命令调取的就可以,点击这样是不行的