Kuja 发表于 2003-5-28 10:59:00

各位,帮忙看看程序错在哪里?

dcl文件:

gear:dialog {
label="齿数";
:edit_box {
label="输入齿数";
key="mun";
edit_width=8;
}
:popup_list {
label="模数";
key="mod";
edit_width=8;
}
:edit_box {
label="厚度";
key="hight";
edit_width=9;
}
:edit_box {
label="小圆半径";
key="d";
edit_width=9;
}
ok_button;
}

程序:

;               输入数据
(defun input ()
        (setq p1        (getpoint         "\n输入齿轮的中心点:"))

        (setq n1         (GET_TILE       "mun")
              n         (atoi n1))
        (setq mod1        (GET_TILE        "mod")
              mod       (atoi mod1))
        (setq gh1        (GET_TILE        "hight")
              gh      (atoi gh1))
        (setq d11        (GET_TILE       "d")
              d1      (atoi d11))
)

(defun calculating1 ()
    ........)

;主程序
(defun c:gear ()
      (setq it_dcl (load_dialog "gear.dcl"))
      (if (< it_dcl 0)
    (exit)
          )
      (if (not (new_dialog "gear" it_dcl))
    (exit)
)
      (start_list "mod")   
      (setq modshu '("1" "1.25" "1.5" "2" "2.5" "3" "4" "5" "6" "8" "10" "12" "16" "20" "25" "32" "40" "50"))
      (mapcar 'add_list modshu)
      (end_list)
      (action_tile "accept" "(input)(done_dialog)"
      (start_dialog)

        (input)
        (calculating1)
        )
        (prompt "\n输入gear运行程序"))


输入后反馈:
error: bad argument type: stringp nil

Kuja 发表于 2003-5-28 11:53:00

那就是说怎样可以取到dcl文件中的数据。

wangguang006 发表于 2003-5-28 12:26:00

错误原因在于括号

语句(action_tile "accept" "(input)(done_dialog)" 最后少了")",
语句(prompt "\n输入gear运行程序")) 最后多了")"

Kuja 发表于 2003-5-28 13:08:00

我修改好了,但是也有同样的错误,怎么办?

Kuja 发表于 2003-5-28 13:12:00

同样

也就是

dcl文件:
a:dialog {
label="齿数";
:popup_list {
label="模数";
key="mod";
edit_width=8;
}
ok_button;
}

lisp文件:
(defun c:a()
   (setq it_dcl (load_dialog "a.dcl"))
      (if (< it_dcl 0)
    (exit)
          )
      (if (not (new_dialog "a" it_dcl))
    (exit)
)
      (start_list "mod")   
      (setq modshu '("1" "1.25" "1.5" "2" "2.5" "3" "4" "5" "6" "8" "10" "12" "16" "20" "25" "32" "40" "50"))
      (mapcar 'add_list modshu)
      (end_list)
(action_tile "accept" "(input)(done_dialog)")
      (start_dialog)
    (setq mod1        (GET_TILE "mod")
              mod       (atoi mod1))
    (princ mod)
    )
也有同样错误,
怎么办啊,急~~

meflying 发表于 2003-5-28 16:40:00

未仔细调试,看错误提示,应该是在INPUT函数中,GET_TILE有些未从对话框中取得正确

未仔细调试,看错误提示,应该是在INPUT函数中,GET_TILE有些未从对话框中取得正确值

mmmmmm 发表于 2003-6-3 17:16:00

check

(defun input ()
(setq p1 (getpoint "\n输入齿轮的中心点:"))

(setq        n1 (GET_TILE "mun")
        n(atoi n1)
)
(setq        mod1 (GET_TILE "mod")
        mod(atoi mod1)
)
(setq        gh1 (GET_TILE "hight")
        gh(atoi gh1)
)
(setq        d11 (GET_TILE "d")
        d1(atoi d11)
)
)

(defun calculating1 ()
(princ)
)

                                        ;主程序
(defun c:gear ()
(setq it_dcl (load_dialog (findfile "gear.dcl")))
(if (< it_dcl 0)
    (exit)
)
(if (not (new_dialog "gear" it_dcl))
    (exit)
)
(start_list "mod")
(setq        modshu '("1"        "1.25" "1.5""2"    "2.5""3"           "4"
               "5"        "6"    "8"    "10"   "12"   "16"   "20"
               "25"        "32"   "40"   "50"
                )
)
(mapcar 'add_list modshu)
(end_list)
(action_tile
    "accept"
    "(input)(done_dialog)"
    (start_dialog)

    (input)
    (calculating1)
)

)
页: [1]
查看完整版本: 各位,帮忙看看程序错在哪里?