梦里水香 发表于 2014-5-26 22:56
在谢谢了,这个问题想了两天脑袋都想破了,现在终于解决了。
再次感谢!
- (defun C:yj_wt ()
- (setvar "osmode" 0)
- (while
- (null(vl-remove'nil(yj_wtsj(atof(rtos(distance(setq p0(getpoint"\n set basepoint:"))(setq p1(getpoint p0"\n input zhijing:")))2 1)))))
- )
- (setq tt (getdist p1 "\n input bihou:")
- ang (angle p0 p1)
- p00 (polar p0 ang (+ A (/ l 2)))
- p2 (polar p0 ang (* 0.5 l))
- p3 (polar p2 (- ang (/ pi 4)) (* (sqrt 2) A))
- p6 (polar p0 ang tt)
- p7 (polar p1 ang (* tt -1))
- p4 (polar p00 (- ang (/ pi 2)) (- A (/ l 2)))
- p5 (polar p00 (- ang (/ pi 2)) (+ A (/ l 2)))
- p8 (polar p4 (- ang (/ pi 2)) tt)
- p9 (polar p5 (+ ang (/ pi 2)) tt))
- (command "_.line" p0 p1 "")
- (command "_.line" p4 p5 "")
- (command "_.arc" "c" p00 p1 p4)
- (command "_.arc" "c" p00 p0 p5)
- (command "_.arc" "c" p00 p6 p9)
- (command "_.arc" "c" p00 p7 p8)
- (command "_.arc" "c" p00 p2 p3)
- (princ)
- )
先对P0,P1两点得到的距离进行检查,如果有不小心点错了马上重新获取p0,p1 |