土木在线论坛 \ 建筑设计 \ CAD下载及教程 \ 标准化输入对话框lisp代码

标准化输入对话框lisp代码

发布于:2008-04-19 09:07:19 来自:建筑设计/CAD下载及教程 [复制转发]
;;;标准输入对话框
;;;调用形式 (InputBox 显示的对话框名称 表( ( "editbox显示的说明" "editbox显示值" "editbox显示宽度") ...) )
;;;注意,调用参数均为字符串形式
;;;返回值为与输入表长度相等的字符串列表
;;;注意:以下代码未对输入代码格式进行检查,有需要时,需人加入格式检查的代码
(defun InputBox (strDialogName EditBoxDefList
/ ResultList fStream dclname tempFileName fileN fileStream templist i
dclid)
;;;-------------------------------------------------
(defun GetInput (len)
(setq i 1
ResultList nil
)

(repeat len
(setq ResultList
(append ResultList (list (get_tile (itoa i))))
)

(setq i (1+ i))
)
)
;;;-------------------------------------------------
(setq tempFileName (vl-filename-mktemp "dcltmp.dcl"))
(setq fileN (open tempFileName "w"))

(setq fileStream (list
"InputBox:dialog {\n"
(strcat "label =\"" strDialogName "\";\n")
)
)
(setq i 0)
(repeat (length EditBoxDefList)
(setq templist (nth i EditBoxDefList))
(setq fileStream (append fileStream
(list
":edit_box{\n"
"allow_accept = true ;\n"
(strcat "edit_width =" (caddr templist) ";\n")
"fixed_width = true ;\n"
(strcat "key =\"" (itoa (1+ i)) "\";\n")
(strcat "label=\"" (car templist) "\";\n")
(strcat "value=\"" (cadr templist) "\";\n")
)
)
)

(setq i (1+ i))
)

(setq fileStream (append fileStream
(list

"} ok_cancel;\n"
"}\n"
)
)
)
(foreach fStream
fileStream
(princ fStream fileN)
)
(close fileN)

(setq dclname tempFileName)


(setq dclid (load_dialog dclname))
(if (not (new_dialog "InputBox" dclid ""))
(progn (alert "对话框加载失败!") (exit))
)

(action_tile "accept" "(GetInput (length EditBoxDefList) ) (done_dialog 1)" )

(start_dialog)

(unload_dialog dclid)
(vl-file-delete dclname)

ResultList
)
;;;-------------------------------------------------
这个家伙什么也没有留下。。。

CAD下载及教程

返回版块

52.08 万条内容 · 665 人订阅

猜你喜欢

阅读下一篇

批量文字样式管理工程

我自己写的一个小工具

回帖成功

经验值 +10