本帖最后由 xshrimp 于 2012-3-6 10:49 编辑
 - (defun c:test( / dclid dclname filen gyxh stream tempname)
- (defun act-dcl()
- (setq #gydata# (subst (list $key $value)(assoc $key #gydata#)#gydata#))
- (set_tile "GYXH" (setq gyxh (strcat(get_tile "GY")(get_tile "XH"))))
- (setq #gydata# (subst(list "GYXH" gyxh)(assoc "GYXH" #gydata#)#gydata#))
- )
- (defun act-dcl-gyxh( )
- (setq #gydata# (subst(list "GYXH" $value)(assoc "GYXH" #gydata#)#gydata#))
- )
- (defun act-dcl-in()
- (alert (cadr(assoc "GYXH" #gydata#)))
- )
- (setq dclname
- (cond
- ((setq tempname (vl-filename-mktemp "gps-dcl-tmp.dcl") filen (open tempname "w"))
- (foreach stream
- '(
- "test:dialog{\n"
- "label=\"管牙型号标注\";\n"
- ":row{\n"
- ":boxed_radio_column{key=\"GY\";label=\"管牙\";width=15;\n"
- ":radio_button{key=\"PT\";label=\"PT\";}\n"
- ":radio_button{key=\"NPT\";label=\"NPT\";}\n"
- ":radio_button{key=\"BSP\";label=\"BSP\";}\n"
- ":radio_button{key=\"BSPT\";label=\"BSPT\";}\n"
- "}\n"
- ":boxed_radio_column{key=\"XH\";label=\"型号\";width=15;\n"
- ":radio_button{key=\"1/8\";label=\"1/8\";}\n"
- ":radio_button{key=\"1/4\";label=\"1/4\";}\n"
- ":radio_button{key=\"3/8\";label=\"3/8\";}\n"
- ":radio_button{key=\"1/2\";label=\"1/2\";}\n"
- ":radio_button{key=\"3/4\";label=\"3/4\";}\n"
- "}\n"
- "}\n"
- ":edit_box{key=\"GYXH\";label=\"管牙型号\";}\n"
- ":row{\n"
- ":button{key=\"IN\";label=\"插入引线标注\";}\n"
- ":button{is_cancel=true;key=\"cancel\";label=\"取消\";}\n"
- "}\n"
- "}\n"
- )
- (princ stream filen)
- )
- (close filen)
- tempname
- )))
- (setq dclid (load_dialog dclname))
- (if (not (new_dialog "test" dclid)) (progn (alert "dcl对话框加载失败.")(exit)))
- (if (null #gydata#)
- (setq #gydata# (list (list "GY" "PT")(list "XH" "1/8")(list "GYXH" "PT1/8")))
- )
- (set_tile "GY" (cadr(assoc "GY" #gydata#)))
- (set_tile "XH" (cadr(assoc "XH" #gydata#)))
- (set_tile "GYXH" (cadr(assoc "GYXH" #gydata#)))
- (action_tile "GY" "(act-dcl)")
- (action_tile "XH" "(act-dcl)")
- (action_tile "GYXH" "(act-dcl-gyxh)")
- (action_tile "IN" "(act-dcl-in)")
- (action_tile "cancel" "(done_dialog 0)")
- (start_dialog)
- (unload_dialog dclid)
- (vl-file-delete dclname)
- )
|