明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2510|回复: 4

[源码] 图框项目快速修改程序的问题

[复制链接]
发表于 2013-4-3 16:59:37 | 显示全部楼层 |阅读模式

             图一

              图二


               图三
TK3.DOC
  1. tk3a: dialog {label = "图框项目修改";
  2.    spacer;
  3.      : row {
  4.        :boxed_row { label = "输入资料";
  5.           :column {
  6.              :button {label= "品名";key= "ty1";fixed_height= true;}         
  7.              :button {label= "模号";key= "ty2";fixed_height= true;}
  8.              :button {label= "图号";key= "ty3";fixed_height= true;}
  9.              :button {label= "路径";key= "ty4";fixed_height= true;}
  10.              :button {label= "设计";key= "ty5";fixed_height= true;}
  11.              :button {label= "审核";key= "ty6";fixed_height= true;}
  12.              :button {label= "核准";key= "ty7";fixed_height= true;}
  13.              :button {label= "机型";key= "ty8";fixed_height= true;}   
  14.              :button {label= "件名";key= "ty9";fixed_height= true;}
  15.              :button {label= "版本";key= "ty10";fixed_height= true;}

  16. }
  17.           :column {
  18.              :edit_box {label= "";key= "gy1";edit_width= 15;edit_limit= 15;}      
  19.              :edit_box {label= "";key= "gy2";edit_width= 15;edit_limit= 15;}
  20.              :edit_box {label= "";key= "gy3";edit_width= 15;edit_limit= 15;}
  21.              :edit_box {label= "";key= "gy4";edit_width= 15;edit_limit= 15;}
  22.              :edit_box {label= "";key= "gy5";edit_width= 15;edit_limit= 15;}
  23.              :edit_box {label= "";key= "gy6";edit_width= 15;edit_limit= 15;}
  24.              :edit_box {label= "";key= "gy7";edit_width= 15;edit_limit= 15;}
  25.              :edit_box {label= "";key= "gy8";edit_width= 15;edit_limit= 15;}      
  26.              :edit_box {label= "";key= "gy9";edit_width= 15;edit_limit= 15;}      
  27.              :edit_box {label= "";key= "gy10";edit_width= 15;edit_limit= 15;}

  28. }
  29.            }



  30.      }

  31.      :row {
  32.       spacer;
  33.      ok_button;
  34.           cancel_button;
  35.       spacer;
  36.           }
  37. }


  38. tk3b: dialog {label = "选择对应词语";
  39.            :list_box {key= "zhi1";width= 34.5;height= 18;allow_accept = true;fixed_width= true;}
  40.            :edit_box {label= "编缉输入";mnemonic= "N";key= "zhi2";fixed_width= true;fixed_height= true;edit_width = 21;}
  41.            :row {alignment = centered;
  42.                :button {label =" 加入 ";key= "add";}
  43.               spacer;
  44.               spacer;
  45.                ok_button;
  46.            }
  47. }


  1. (defun c:tk3 (/)
  2.      (if (< (SETq dd_id (LOAD_DIALOG "tk3.DCL")) 0)
  3.           (exit)
  4.           )
  5.      (if (not (NEW_DIALOG "tk3a" dd_id))
  6.           (exit)
  7.           )
  8.      (lboxt)
  9.      (action_tile "accept" "(getdat)(done_dialog 1)")
  10.      (action_tile "cancel" "(done_dialog 0)")
  11.      (action_tile "ty1" "(auto_s1)")
  12.      (action_tile "ty2" "(auto_s2)")
  13.      (action_tile "ty3" "(auto_s3)")
  14.      (action_tile "ty4" "(auto_s4)")
  15.      (action_tile "ty5" "(auto_s5)")
  16.      (action_tile "ty6" "(auto_s6)")
  17.      (action_tile "ty7" "(auto_s7)")
  18.      (action_tile "ty8" "(auto_s8)")
  19.      (action_tile "ty9" "(auto_s9)")
  20.      (action_tile "ty10" "(auto_s10)")
  21.      (setq sdt (start_dialog))
  22.      (unload_dialog dd_id)
  23.      (if( > sdt 0)(iio))
  24.      )
  25. (DEFUN LBOXt ()
  26.      (setq filex (open "C:\\XZH\\tk3.mb" "r"))
  27.      (SETQ TEMP_S (READ-LINE filex))
  28.      (WHILE (/= TEMP_S NIL)
  29.           (SETQ TMP_L (APPEND TMP_L (LIST TEMP_s)))
  30.           (setq TEMP_S (READ-LINE filex))
  31.           )
  32.      (close filex)
  33.      (set_tile "gy1" (nth 1  tmp_l))
  34.      (set_tile "gy2" (nth 2  tmp_l))   
  35.      (set_tile "gy3" (nth 3  tmp_l))
  36.      (set_tile "gy4" (nth 4  tmp_l))
  37.      (set_tile "gy5" (nth 5  tmp_l))
  38.      (set_tile "gy6" (nth 6  tmp_l))
  39.      (set_tile "gy7" (nth 7  tmp_l))
  40.      (set_tile "gy8" (nth 8  tmp_l))
  41.      (set_tile "gy9" (nth 9 tmp_l))
  42.      (set_tile "gy10" (nth 10 tmp_l))   
  43.      )

  44. (defun auto_s1 ()
  45. (if (< (SETq dd_id (LOAD_DIALOG "tk3.DCL")) 0)(exit))
  46. (if (not (NEW_DIALOG "tk3b" dd_id))(exit))
  47.    (setq fi_path "C:\\XZH\\" nb "tk3pm.mb")
  48.      (fi_a)
  49.      (action_tile "add" "(auto_add)")
  50.       (ACTION_TILE "zhi1" "(SETQ TMP_R (ATOI (GET_TILE \"zhi1\")))(rre)")
  51.       (action_tile "accept" "(rrh)(done_dialog 2)")
  52.      (setq  see (start_dialog))
  53.      (unload_dialog dd_id)  
  54.      (if (>= see 0)
  55.         (set_tile "gy1" mmc)
  56.     )
  57. )

  58. (defun auto_s2 ()
  59. (if (< (SETq dd_id (LOAD_DIALOG "tk3.DCL")) 0)(exit))
  60. (if (not (NEW_DIALOG "tk3b" dd_id))(exit))
  61.    (setq fi_path "C:\\XZH\\" nb "tk3mh.mb")
  62.      (fi_a)
  63.      (action_tile "add" "(auto_add)")
  64.       (ACTION_TILE "zhi1" "(SETQ TMP_R (ATOI (GET_TILE \"zhi1\")))(rre)")
  65.       (action_tile "accept" "(rrh)(done_dialog 2)")
  66.      (setq  see (start_dialog))
  67.      (unload_dialog dd_id)  
  68.      (if (>= see 0)
  69.         (set_tile "gy2" mmc)
  70.     )
  71. )

  72. (defun getdat ()
  73.      (setq w1  (get_tile "gy1")         
  74.            w2  (get_tile "gy2")     
  75.            w3  (get_tile "gy3")
  76.            w4  (get_tile "gy4")
  77.            w5  (get_tile "gy5")
  78.            w6  (get_tile "gy6")
  79.            w7  (get_tile "gy7")
  80.            w8  (get_tile "gy8")   
  81.            w9  (get_tile "gy9")
  82.            w10  (get_tile "gy10")
  83.                      
  84.            )
  85.          )
  86. (defun  iio(/ pt1 pt2 disx disy acx acy pt0 os )
  87.    (setvar "cmdecho" 0)
  88.    (setq pt1 (getpoint "\n-->请选择图形左上角:"))
  89.    (setq pt2 (getcorner pt1 "\n-->请选择图形右下角:"))
  90.    (setq disx (abs (- (car pt1) (car pt2))))
  91.    (setq disy (abs (- (cadr pt1) (cadr pt2))))
  92.    (setq acx  (/ disx 230.00))
  93.    (setq acy  (/ disy 130.00))
  94.    (if (> acy acx)(setq acx acy))   
  95.    (setq pt0 (list (- (car pt1 ) (* 37 acy ))(+ (cadr pt1) (* 25 acy))(caddr pt1)))
  96.    (setq os (getvar "osmode"))
  97.    (setvar "osmode" 1)
  98.    (command "style" "standard" "宋体" "" "" "" "" "")
  99.    (savefile)
  100.    (command "insert"  "tk3.dwg" pt0 "x" acx "" "" ""  w1 w2 w3 w4 w5 w6 w7 w8 w9 w10)
  101.    (setvar "osmode" os)
  102.     (princ)
  103. )

  104.   (defun savefile()
  105.    (setq filey(open "C:\\XZH\\tk3.mb" "w"))
  106.    (write-line w1 filey)  
  107.    (write-line w2 filey)   
  108.    (write-line w3 filey)
  109.    (write-line w4 filey)
  110.    (write-line w5 filey)
  111.    (write-line w6 filey)
  112.    (write-line w7 filey)
  113.    (write-line w8 filey)  
  114.    (write-line w9 filey)
  115.    (write-line w10 filey)  
  116.     (close filey)   
  117.   )

  118. (defun auto_add()
  119.    (setq te_d (get_tile "zhi2"))
  120.   (setq fiy (open (strcat fi_path nb ) "a"))
  121.   (write-line te_d fiy)
  122.   (close fiy)
  123. (fi_a)
  124. )


  125. (defun fi_a (/ l1 l3 fi n mst)
  126.   (setq        fi (open (strcat fi_path nb ) "r"))
  127.   (start_list "zhi1")
  128.   (while (setq tmp_w (read-line fi))
  129.     (add_list  tmp_w )
  130.      )
  131.   (setq tmp_x tmp_w)
  132.   (end_list)
  133.   (close fi)
  134. )

  135. (defun rre()   
  136.   (SETQ F_ID (OPEN (strcat fi_path nb ) "r"))
  137.   (setq tmp_r(+ 1 tmp_r))
  138.   (REPEAT TMP_R(setq mmd (READ-LINE F_ID)))
  139.   (setq mmc(get_tile "zhi2"))
  140.    (set_tile "zhi2" mmd)
  141. )

  142. (defun rrh ()
  143.    (setq mmc(get_tile "zhi2")))

  144. (defun auto_s3 ()
  145. (if (< (SETq dd_id (LOAD_DIALOG "tk3.DCL")) 0)(exit))
  146. (if (not (NEW_DIALOG "tk3b" dd_id))(exit))
  147.    (setq fi_path "C:\\XZH\\" nb "tk3th.mb")
  148.      (fi_a)
  149.      (action_tile "add" "(auto_add)")
  150.       (ACTION_TILE "zhi1" "(SETQ TMP_R (ATOI (GET_TILE \"zhi1\")))(rre)")
  151.       (action_tile "accept" "(rrh)(done_dialog 2)")
  152.      (setq  see (start_dialog))
  153.      (unload_dialog dd_id)  
  154.      (if (>= see 0)
  155.         (set_tile "gy3" mmc)
  156.     )
  157. )

  158. (defun auto_s4 ()
  159. (if (< (SETq dd_id (LOAD_DIALOG "tk3.DCL")) 0)(exit))
  160. (if (not (NEW_DIALOG "tk3b" dd_id))(exit))
  161.    (setq fi_path "C:\\XZH\\" nb "tk3lj.mb")
  162.      (fi_a)
  163.      (action_tile "add" "(auto_add)")
  164.       (ACTION_TILE "zhi1" "(SETQ TMP_R (ATOI (GET_TILE \"zhi1\")))(rre)")
  165.       (action_tile "accept" "(rrh)(done_dialog 2)")
  166.      (setq  see (start_dialog))
  167.      (unload_dialog dd_id)  
  168.      (if (>= see 0)
  169.         (set_tile "gy4" mmc)
  170.     )
  171. )

  172. (defun auto_s5 ()
  173. (if (< (SETq dd_id (LOAD_DIALOG "tk3.DCL")) 0)(exit))
  174. (if (not (NEW_DIALOG "tk3b" dd_id))(exit))
  175.    (setq fi_path "C:\\XZH\\" nb "tk3sj.mb")
  176.      (fi_a)
  177.      (action_tile "add" "(auto_add)")
  178.       (ACTION_TILE "zhi1" "(SETQ TMP_R (ATOI (GET_TILE \"zhi1\")))(rre)")
  179.       (action_tile "accept" "(rrh)(done_dialog 2)")
  180.      (setq  see (start_dialog))
  181.      (unload_dialog dd_id)  
  182.      (if (>= see 0)
  183.         (set_tile "gy5" mmc)
  184.     )
  185. )

  186. (defun auto_s6 ()
  187. (if (< (SETq dd_id (LOAD_DIALOG "tk3.DCL")) 0)(exit))
  188. (if (not (NEW_DIALOG "tk3b" dd_id))(exit))
  189.    (setq fi_path "C:\\XZH\\" nb "tk3sh.mb")
  190.      (fi_a)
  191.      (action_tile "add" "(auto_add)")
  192.       (ACTION_TILE "zhi1" "(SETQ TMP_R (ATOI (GET_TILE \"zhi1\")))(rre)")
  193.       (action_tile "accept" "(rrh)(done_dialog 2)")
  194.      (setq  see (start_dialog))
  195.      (unload_dialog dd_id)  
  196.      (if (>= see 0)
  197.         (set_tile "gy6" mmc)
  198.     )
  199. )

  200. (defun auto_s7 ()
  201. (if (< (SETq dd_id (LOAD_DIALOG "tk3.DCL")) 0)(exit))
  202. (if (not (NEW_DIALOG "tk3b" dd_id))(exit))
  203.    (setq fi_path "C:\\XZH\\" nb "tk3hz.mb")
  204.      (fi_a)
  205.      (action_tile "add" "(auto_add)")
  206.       (ACTION_TILE "zhi1" "(SETQ TMP_R (ATOI (GET_TILE \"zhi1\")))(rre)")
  207.       (action_tile "accept" "(rrh)(done_dialog 2)")
  208.      (setq  see (start_dialog))
  209.      (unload_dialog dd_id)  
  210.      (if (>= see 0)
  211.         (set_tile "gy7" mmc)
  212.     )
  213. )

  214. (defun auto_s8 ()
  215. (if (< (SETq dd_id (LOAD_DIALOG "tk3.DCL")) 0)(exit))
  216. (if (not (NEW_DIALOG "tk3b" dd_id))(exit))
  217.    (setq fi_path "C:\\XZH\\" nb "tk3jx.mb")
  218.      (fi_a)
  219.      (action_tile "add" "(auto_add)")
  220.       (ACTION_TILE "zhi1" "(SETQ TMP_R (ATOI (GET_TILE \"zhi1\")))(rre)")
  221.       (action_tile "accept" "(rrh)(done_dialog 2)")
  222.      (setq  see (start_dialog))
  223.      (unload_dialog dd_id)  
  224.      (if (>= see 0)
  225.         (set_tile "gy8" mmc)
  226.     )
  227. )

  228. (defun auto_s9 ()
  229. (if (< (SETq dd_id (LOAD_DIALOG "tk3.DCL")) 0)(exit))
  230. (if (not (NEW_DIALOG "tk3b" dd_id))(exit))
  231.    (setq fi_path "C:\\XZH\\" nb "tk3jm.mb")
  232.      (fi_a)
  233.      (action_tile "add" "(auto_add)")
  234.       (ACTION_TILE "zhi1" "(SETQ TMP_R (ATOI (GET_TILE \"zhi1\")))(rre)")
  235.       (action_tile "accept" "(rrh)(done_dialog 2)")
  236.      (setq  see (start_dialog))
  237.      (unload_dialog dd_id)  
  238.      (if (>= see 0)
  239.         (set_tile "gy9" mmc)
  240.     )
  241. )

  242. (defun auto_s10 ()
  243. (if (< (SETq dd_id (LOAD_DIALOG "tk3.DCL")) 0)(exit))
  244. (if (not (NEW_DIALOG "tk3b" dd_id))(exit))
  245.    (setq fi_path "C:\\XZH\\" nb "tk3bb.mb")
  246.      (fi_a)
  247.      (action_tile "add" "(auto_add)")
  248.       (ACTION_TILE "zhi1" "(SETQ TMP_R (ATOI (GET_TILE \"zhi1\")))(rre)")
  249.       (action_tile "accept" "(rrh)(done_dialog 2)")
  250.      (setq  see (start_dialog))
  251.      (unload_dialog dd_id)  
  252.      (if (>= see 0)
  253.         (set_tile "gy10" mmc)
  254.     )
  255. )




以上程序及对话框,在执行TK3时有以下问题点

1、输入TK3命令时,出现 tk3 ; 错误: 参数类型错误: stringp nil,再按一次便出现图一对话框,但对话框里的赋值会乱掉

2、输入对应的内容后按确定,出现图二,那些赋值没有被赋上,如何实现图三的

以上问题点,请高手们指点,如何修改程序



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
"觉得好,就打赏"
还没有人打赏,支持一下
 楼主| 发表于 2013-4-4 14:38:43 | 显示全部楼层
请高手们来指导一下,如何如何修改程序,谢谢!!
发表于 2013-6-26 11:12:05 | 显示全部楼层
顶起来                                       
发表于 2013-6-26 18:23:46 | 显示全部楼层
发表于 2013-8-1 18:13:30 | 显示全部楼层
帮你顶一下。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-26 11:48 , Processed in 0.314475 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表