CAD AutoLisp 梯形折线绘制
获取两个点的角度
lisp
(setq a (getpoint))
(setq b (polar a 0 20))
具体实现
lisp
(defun c:TT()
(setq pa (getpoint "\nget1"))
(setq pb (getpoint pa "\nget1"))
(grdraw pa pb 7)
(setq pc (getpoint pb "\nget1"))
(setq n (getint "\n输入总数:"))
;======计算
(setq w (distance pa pb))
(setq h (distance pb pc))
(setq w1 (/ w n))
(setq H1 (/ H n))
(setq p1 (polar pc (angle pb pa) w1))
(setq p2 (polar p1 (angle pc pb) h1))
;======输出
(command "pline" "non" pa "non" pb "non" pc "non" p1 "non" p2)
(repeat (1- n)
(setq p1 (polar p2 (angle pb pa) w1))
(setq p2 (polar p1 (angle pc pb) h1))
(command "non" p1 "non" p2)
)
(command "")
(princ)
)