AutoLISP实现同时绘制多条直线

AutoLISP实现同时绘制多条直线,没有预览效果,代码如下。

(defun c:tt ()
    (setq r (getreal "\n请输入风管宽度:"))
    (if    (= nil r)
    (setq r 100)
    )
    (while t
    (if
        (= p1 nil)
           (setq p1 (getpoint "\n起点:"))
    )
    (setq p2 (getpoint p1 "\n下一点:"))
    (command "line" p1 p2 "")
    (setq ang (angle p1 p2))
    (setq p1down (polar p1 (+ ang (* 1.5 pi)) (/ r 2)))
    (setq p2down (polar P2 (+ ang (* 1.5 pi)) (/ r 2)))
    (setq p1up (polar p1 (+ ang (/ pi 2)) (/ r 2)))
    (setq p2up (polar p2 (+ ang (/ pi 2)) (/ r 2)))
    (command "line" p1 p2 "")
    (command "line" p1up p2up "")
    (command "line" p1down p2down "")
    (setq p1 p2)
    )
)

代码完。

绘制的时候没有输入管道尺寸的功能,第二次调用命令的时候p1点会调用上次命令的终点。

作者:codee
文章千古事,得失寸心知。


原文地址:https://www.cnblogs.com/bimgoo/p/2503091.html