(defun c:dp (/ os dist e pt1 pt2 pt3 a)
(command "cmdecho" 0)
(setq lwe (getvar "useril"))
(if (= lwe 0)
(progn
(initget (+ 2 4))
(setq lwe (getint "出图比例[1:?]:"))
(if (= lwe nil)
(setq lwe 100)
)
(setvar "useril" lwe)
)
)
(setq lwe (/ lwe 2))
(command "pline" '(0 0) "w" lwe lwe "")
(setvar "osmode" 695)
(setq pt (getpoint "\n起点:"))
(if (= pt nil)
(prompt "\空格与或回车结束!")
)
(initget (+ 2 4))
(setq dist (getdist pt "\n宽度<240>:"))
(if (= dist nil)
(setq dist 240)
)
(setq dist (/ dist 2.0))
(if (= pt nil) (prompt "\ndddddddd"))
(setq po (getpoint pt "\n下一点:"))
(setq ang (angle pt po))
(setq pt1 (polar pt (+ ang (/ pi 2)) dist))
(setq pt2 (polar pt (- ang (/ pi 2)) dist))
(setq po1 (polar po (+ ang (/ pi 2)) dist))
(setq po2 (polar po (- ang (/ pi 2)) dist))
(setvar "osmode" 0)
(command "pline" pt1 po1 "" "pline" pt2 po2 "")
(setq e 1)
(while e
(setvar "osmode" 695)
(setq pb (getpoint po "\n下一点:"))
(if (= pb nil)
(exit)
)
(setq ang1 (angle po pb))
(setq pn1 (polar po (+ ang1 (/ pi 2)) dist))
(setq pn2 (polar po (- ang1 (/ pi 2)) dist))
(setq pb1 (polar pb (+ ang1 (/ pi 2)) dist))
(setq pb2 (polar pb (- ang1 (/ pi 2)) dist))
(setq pe1 (inters pt1 po1 pn1 pb1 nil))
(setq pe2 (inters pt2 po2 pn2 pb2 nil))
(setq ent (ssget po1))
(command "erase" ent "")
(setvar "osmode" 0)
(command "pline" pt1 pe1 "" "pline" pt2 pe2 "")
(command "pline" pe1 pb1 "" "pline" pe2 pb2 "")
(setq po pb
pt1 pe1
pt2
pe2
po1
pb1
po2
pb2
)
)
(command "cmdecho" 1)
)