ジガヤ戏 发表于 2012-4-20 19:06:59

提示参数太少,调试了很久,但是找不出问题所在

把括号的数目用word数过了,一样,参数也是不会有问题的呀,但是在输入完参数还是提示参数太少,想请教一下大家这是什么问题呢?

(defun c:squ( / n p w r0 r1)
(setq n (getint "\nNumber Of Key:"))
(setq p (getpoint "\nBasePoint:"))                     ;(sqrt (- (* d0 d0) (* (/ w 2) (/ w 2))))
(setq w (getint "\nSide width:"))
(setq r0 (getint "\nInnerRadius:"))
(setq r1 (getint "\nOuterRadius:"))
;(setq a (getangle "\nInnitialAngle:"))
   (setq an (/ (* 2 pi) n))
   (setq dt (/ (* 2 pi) n) a (/ (* 2 pi) (* 2 n)))
;(setq a (/ (* 2 pi) (* 2 n)))
(while (<= an ( * 2 pi))
(setq p1 (polar p a r1 ))
   (setq p2 (polar p1 (+ a (* 1.5 pi))(/ w 2)))
   (setq p3 (polar p2 (+ a pi) (-r1(sqrt (- (* r0 r0) (* (/ w 2) (/ w 2)))))))
   (setq p4 (polar p3 (+ a (* 0.5 pi) w)))
   (setq p5 (polar p4 a (-r1(sqrt (- (* r0 r0) (* (/ w 2) (/ w 2)))))))
   (command "pline" p2 "w" 0.5 0.5p3 p4 p5 "c")
   (setq a (+ an a))
(setq an (+ an dt))      
)
   (command "redraw")
)

ジガヤ戏 发表于 2012-4-20 19:12:03

另外lz也有试过一下的方法:
(defun c:squ()
(setq n (getint "\nNumber Of Key:"))
(setq p (getpoint "\nBasePoint:"))                     ;(sqrt (- (* d0 d0) (* (/ w 2) (/ w 2))))
(setq w (getint "\nSide width:"))
(setq r0 (getint "\nInnerRadius:"))
(setq r1 (getint "\nOuterRadius:"))
;(setq a (getangle "\nInnitialAngle:"))
        (setq an (/ (* 2 pi) n))
        (setq dt (/ (* 2 pi) n) a (/ (* 2 pi) (* 2 n)))
        ;(setq a (/ (* 2 pi) (* 2 n)))
(while (<= an ( * 2 pi))
        (setq p1 (polar p a r1 ))
        (setq p2 (polar p1 (+ a (* 1.5 pi))(/ w 2)))
        (setq p3 (polar p2 (+ a pi) (-r1(sqrt (- (* r0 r0) (* (/ w 2) (/ w 2)))))))
        (setq p4 (polar p3 (+ a (* 0.5 pi) w)))
            (setq p5 (polar p4 a (-r1(sqrt (- (* r0 r0) (* (/ w 2) (/ w 2)))))))
        (command "pline" p2 "w" 0.5 0.5p3 p4 p5 "c")
            (setq a (+ an a))
        (setq an (+ an dt))             
)
        (command "redraw")
)

逐个的输入参数,还是太少

Andyhon 发表于 2012-4-20 19:29:08

TryGetDist 取代 GetInt
(setq w (GetDist "\nSide width:"))
(setq r0 (GetDist "\nInnerRadius:"))
(setq r1 (GetDist "\nOuterRadius:"))

Gu_xl 发表于 2012-4-20 19:32:57

(setq p4 (polar p3 (+ a (* 0.5 pi) w)))少参数

ジガヤ戏 发表于 2012-4-20 19:43:12

如何才能进入单步调试状态呢?

Andyhon 发表于 2012-4-20 20:09:15

先这样测
a 得有值

(setq p4 (polar p3 (+ a (* 0.5 pi) w)))
猜 ==>
(setq p4 (polar p3 (+ a (* 0.5 pi)) w))

ジガヤ戏 发表于 2012-4-20 20:52:46

恩,谢谢了,问题已经解决了
页: [1]
查看完整版本: 提示参数太少,调试了很久,但是找不出问题所在