各位,帮忙看看程序错在哪里?
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
那就是说怎样可以取到dcl文件中的数据。
错误原因在于括号
语句(action_tile "accept" "(input)(done_dialog)" 最后少了")",语句(prompt "\n输入gear运行程序")) 最后多了")"
我修改好了,但是也有同样的错误,怎么办?
同样
也就是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)
)
也有同样错误,
怎么办啊,急~~
未仔细调试,看错误提示,应该是在INPUT函数中,GET_TILE有些未从对话框中取得正确
未仔细调试,看错误提示,应该是在INPUT函数中,GET_TILE有些未从对话框中取得正确值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]