AutoLISP等分直线绘制曲线
2011-03-28 09:24 精诚所至 金石为开 阅读(508) 评论(0) 编辑 收藏 举报AutoLISP等分直线绘制曲线,将一条直线等分成n份,并以等分点绘制曲线,代码如下。
(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))
(command "pline" bas1 "a" "a" 180)
(repeat nn
(setq bas2 (polar bas1 ang dd_nn))
(command bas2)
(setq bas1 bas2)
)
(command "")
(entdel en)
(prin1)
)
代码完。
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)