Gu_xl 发表于 2013-1-9 13:07 - (defun c:fx1(/)
- (setvar "cmdecho" 0)
- (setq os (getvar "osmode"))
- (setq p_s (getpoint "\n输入矩形的一点:"))
- (setq p_e (getpoint "\n输入矩形的另一点:"))
- (setq w (getreal "\输入矩形的宽度:"))
- (setq ang (angle p_s p_e) P_L (distance p_s p_e))
- (setq p1(polar p_s (+ ang (* pi 0.5)) (/ w 2)))
- (setq p2(polar p_s (- ang (* pi 0.5)) (/ w 2)))
- (setq p3(polar p_e (+ ang (* pi 0.5)) (/ w 2)))
- (setq p4(polar p_e (- ang (* pi 0.5)) (/ w 2)))
- (setvar "osmode" 0)
- (command "pline" p1 p3 p4 p2 "c")
- (setvar "osmode" os)
- (print)
- )
我是一个LISP初学者,楼上大大们代码写的太好了,不同的思路,很精彩,作为分享,上述代码是我写的,欢迎各种点评
|