第1个回答 2011-12-02
(defun c:zsjx()
(setq fwj (* pi (/ 1.0 6.0)))
(while (setq p1 (getpoint "\n正三角形的顶点:"))
(if (setq L (getdist p1 "\n正三角形的边长:"))
(progn
(setq p2 (polar p1 (* -1.0 fwj) L)
p3 (polar p1 (* 1.0 fwj) L)
)
(command "_pline" p1 p2 p3 "c")
)
)
)
(princ)
)
;或者
(defun c:zsjx1()
(while (setq p1 (getpoint "\n正三角形的顶点:"))
(if (setq p2 (getpoint p1 "\n正三角形的边长:"))
(progn
(setq fwj (angle p1 p2 )
L (distance p1 p2)
p3 (polar p1 (+ fwj (* pi (/ 1.0 3.0))) L);逆时针方向绘制
;p3 (polar p1 (- fwj (* pi (/ 1.0 3.0))) L);顺时针方向绘制
)
(command "_pline" p1 p2 p3 "c")
)
)
)
(princ)
)