本帖最后由 zhanghuohuo 于 2023-8-12 21:28 编辑
小白,参照别人代码写了个工具。
请大神补充一下,要求运行 点取 取值按钮将选取的文本显示在 文本框窗体中。
代码中(defun GL:qz (),没有写[size=22.0875pt]
- (vl-load-com)
- (defun c:tc (/ fname fn x dclid lin)
- (setq fname (vl-filename-mktemp nil nil ".dcl" ))
- (setq fn (open fname "w" ))
- (foreach x '(
-
- " agtckz : dialog{"
- " label="文本取值求和 V1.0";"
- " :row{"
- " :boxed_column{"
- " :row{"
- " :edit_box {key = "1";label = "求和";width = 240;height = 4;value ="3";}"
- " }"
- " :row{"
- " :button{key="2";label="取值";width=16;}"
- " cancel_button;"
- " }"
- " }"
- " }"
- "}"
- );end ;endlist
- (princ x fn)
- (write-line "" fn)
- );end foreach
- (close fn)
- (setq fn (open fname "r" ))
- (setq dclid (load_dialog fname))
- (while (or (eq (substr (setq lin (vl-string-right-trim "" fn)" (vl-string-left-trim "(write-line "" (read-line fn)))) 1 2) "//" ) (eq (substr lin 1 (vl-string-search " " lin)) "" ) (not (eq (substr lin (+ (vl-string-search " " lin) 1) 9) " : dialog" ))))
- (new_dialog (substr lin 1 (vl-string-search " " lin)) dclid)
- (action_tile "2" "(done_dialog 2)" )
- (setq re (start_dialog))
- (cond
- ((= re 2) (GL:qz))
-
- );end cond
- ;(unload_dialog dclid)
- ;(close fn)
- ;(vl-file-delete fname)
- (princ)
- )
- (defun GL:qz ()
- )
|