本帖最后由 aws 于 2024-7-27 13:00 编辑
- (defun c:tt()
- (setq lst
- '(
- "diy:dialog{"
- "label = \"dcl名称\";"
- ":popup_list{"
- "label = \"选择材料:\";"
- "key = \"k-a\";"
- "width = 40;"
- "fixed_width = true;"
- "list = \"钢铁\\n玻璃\\n木头\";"
- "}"
- ":edit_box{"
- "key = \"k-b\";"
- "label = \"属性\";"
- "value = 1;"
- "}"
- ":button{"
- "key = \"k-c\";"
- "label = \"拾取曲线\";"
- "}"
- ":edit_box{"
- "key = \"k-d\";"
- "label = \"图元名\";"
-
- "}"
- "ok_cancel;"
- "}"
- )
- )
- (setq dcl_file(vl-filename-mktemp nil nil ".dcl"))
- (setq file(open dcl_file "w"))
- (foreach str lst(write-line str file))
- (close file)
- (setq dcl_id(load_dialog dcl_file))
- (vl-file-delete dcl_file)
- (new_dialog "diy" dcl_id)
-
- (action_tile "ok" "(done_dialog 1)")
- (action_tile "cancel" "(done_dialog 0)")
- (action_tile "k-a" "(popup(setq v $value))")
- (action_tile "k-c" "(button)")
-
- (setq idd(start_dialog))
- (unload_dialog dcl_id)
- (princ)
- )
- ;---下拉菜单触发
- (defun popup(v /)
- (cond
- ((= v 0)(set_tile "k-b" 1))
- ((= v 1)(set_tile "k-b" 2))
- ((= v 2)(set_tile "k-b" 3))
- )
- )
- ;---按钮菜单触发
- (defun button(v /)
- (set_tile "k-d"(car(entsel "选取一根曲线:")))
- )
- 请教大家,这是一个错误的程序,我想要实现这样的功能,请问怎么修改呢?
|