返回值“输入斜边长度参数类型错误”,请问大神这个代码哪里出错了?
(defun c:443 ()(setq pp1 (getpoint "输入左下角一点"))
(setq ww (getdist pp1 "\n 输入底边长度"))
(setq pp2 (polar pp1 0 ww))
(setq ww2 (getdist pp2 "\n 输入斜边长度"))
(setq ww3(sqrt (- (* ww2 ww2) (* ww1 ww1))))
(setq pp3 (polar pp1 (/ pi 2) ww3))
(command "line" pp1 pp2 pp3 "c")
(prin1)
(defun c:443 ()
(setq pp1 (getpoint "输入左下角一点"))
(setq ww1 (getdist pp1 "\n 输入底边长度"))
(setq pp2 (polar pp1 0 ww))
(setq ww2 (getdist pp2 "\n 输入斜边长度"))
(setq ww3 (sqrt (- (* ww2 ww2) (* ww1 ww1))));注意不要是负数
(setq pp3 (polar pp1 (/ pi 2) ww3))
(command "line" pp1 pp2 pp3 "c")
(prin1)
) 三角函数问题,要控制斜边ww2大于底边ww长度,加个判断语句 tigcat 发表于 2022-5-27 23:55
(defun c:443 ()
(setq pp1 (getpoint "输入左下角一点"))
(setq ww1 (getdist pp1 "\n 输入底边长度 ...
谢谢 ,,,,, (defun c:tt ()
(defun Udist (bit kwd msg def bpt / inp)
(if def
(setq msg (strcat "\n" msg "<" (rtos def) ">: ")bit (* 2 (fix (/ bit 2))))
(setq msg (strcat "\n" msg ": "))
)
(initget bit kwd)
(setq inp (if bpt(getdist msg bpt)(getdist msg)))
(if inp inp def)
)
(setq w1(Udist 7 "" "底边长度<输入或鼠标直接量取>" w1 nil))
(setq w2(Udist 7 "" "斜边长度<输入或鼠标直接量取>" w2 nil))
(while (setq p1 (getpoint "\n输入左下角<退出>: "))
(setq p2 (polar p1 0 ww))
(setq w3 (sqrt (- (* w2 w2) (* w1 w1))))
(setq p3 (polar p2 (/ pi 2) w3))
(command "pline" p1 p2 p3 "c")
)
(princ)
)
页:
[1]