;;;=====================================================================
;;直线---》多段线
(defun c:l2pl (/ ss en nn endata pt_10 pt_11 ang dd dd_nn bas1 bas2)
(setvar "cmdecho" 0)
(princ "\n功能:将直线变为半圆弧相接的多段线。")
(princ "\n请点取直线对象...")
;;对选择的对象类型进行过滤,排除其它对象
(if (setq ss (ssget ":s" (list (cons 0 "line"))))
(progn (setq nn (getint "\n重复次数<5>:"))
;;判断输入的有效性,不能为0或者负值
(if (or (= nn nil) (< nn 1) ) (setq nn 5) )
(setq en
(ssname ss 0)
endata (entget en)
pt_10 (cdr (assoc 10 endata))
pt_11 (cdr (assoc 11 endata))
ang (angle pt_10 pt_11)
dd (distance pt_10 pt_11)
bas1 pt_10 dd_nn (/ dd nn)
)
;;开始绘制多段线,注意关闭捕捉设置
(command "_.pline" "non" bas1 "a" "a" 180)
(repeat nn (setq bas2 (polar bas1 ang dd_nn))
(command "non" bas2) (setq bas1 bas2) )
(command "") (entdel en) )
;_结束
progn )
;_结束
if
(princ)
)
;_结束 defun