AutoLISP等分线段并绘图
2011-03-28 09:04 精诚所至 金石为开 阅读(560) 评论(0) 编辑 收藏 举报AutoLISP等分线段,并在每一段线上绘图,代码如下。
(defun c:test()
(setvar "cmdecho" 0)
(setq en (car (entsel "\n选取线:")))
(setq nn (getint "\n重复次数<5>:"))
(if (null nn) (setq nn 5))
(setq endata (entget en))
(setq pt_10 (cdr (assoc 10 endata)))
(setq pt_11 (cdr (assoc 11 endata)))
(setq ang (angle pt_10 pt_11))
(setq dd (distance pt_10 pt_11))
(setq bas1 pt_10)
(setq dd_nn (/ dd nn))
(repeat nn
(setq bas2 (polar bas1 ang dd_nn))
(command "arc" bas1 "e" bas2 "a" 180)
(command "polygon" 3 "e" bas1 bas2)
(setq bas1 bas2)
)
(entdel en)
(prin1)
)
代码完。