zhhui3297 发表于 2005-3-2 22:18:00

请求帮助

我输入了一个简单程序,如下,运行后,提示“函数类型错误”,我检查了几遍检查不出来,程序是画一个键槽:


defun c:jiancao(/ a b p0 r x0 xe ye ce p1 p2 p3)<BR>       (setq a (getreal "a=:"))<BR>       (setq b (getreal "b=:"))<BR>       (setq p0 (getpoint "enter stare point :"))<BR>       (set r (getreal "r=:"))<BR>       (setq x0 (car p0) y0 (cadr p0))<BR>       (setq xe (- x0 (/ a 2.0)))<BR>       (setq ye (+ y0 (sqrt (- (* r r) (* a a 0.25))<BR>                                                               )<BR>                                               )<BR>        )<BR>       (setq ce (list xe ye))<BR>       (setq p1 (list (- x0 a) y0))<BR>       (setq p2 (list (-x0 a) (- y0 b)))<BR>       (setq p3 (list x0 (- y0 b)))<BR>       (command "pline" p0 "a" "ce" ce p1 "l" p2 p3 "c")<BR>       )

ZZXXQQ 发表于 2005-3-2 23:46:00

(defun c:jiancao(/ a b p0 r x0 xe ye ce p1 p2 p3)
   (setq a (getreal "a=:"))
   (setq b (getreal "b=:"))
   (setq p0 (getpoint "enter stare point :"))
   (setq r (getreal "r=:"))
   (setq x0 (car p0) y0 (cadr p0))
   (setq xe (- x0 (/ a 2.0)))
   (setq ye (+ y0 (sqrt (- (* r r) (* a a 0.25))
               )
             )
)
(setq ce (list xe ye))
(setq p1 (list (- x0 a) y0))
(setq p2 (list (- x0 a) (- y0 b)))
(setq p3 (list x0 (- y0 b)))
(command "pline" p0 "a" "ce" ce p1 "l" p2 p3 "c")
)

zhhui3297 发表于 2005-3-2 23:54:00

ZZXXQQ:how are you .


我看不出来错误何在?

ZZXXQQ 发表于 2005-3-3 00:13:00

原程序第五行(set r (getreal "r="))


应改为(setq r (getreal "r="));setq少写了字母q。


原程序第十四行(setq p2 (list (-x0 a) (- y0 b)))应改为


(setq p2 (list (- x0 a) (- y0 b)));减号与x0之间要用空格。

zhhui3297 发表于 2005-3-3 12:44:00

ZZXXQQ:How are you.


ok! thanks.
页: [1]
查看完整版本: 请求帮助