AutoLISP直线为底做圆形堆栈
2011-03-28 10:01 精诚所至 金石为开 阅读(339) 评论(0) 编辑 收藏 举报AutoLISP直线为底做圆形堆栈,选取一条直线,做圆形堆栈后删除直线。
(defun c:test()
(setvar "cmdecho" 0)
(setq en (car (entsel "\n选取线:")))
(setq endata (entget en))
(setq pt1 (cdr (assoc 10 endata)))
(setq pt2 (cdr (assoc 11 endata)))
(setq nn (getint "\n堆栈数<10>:"))
(if (null nn) (setq nn 10))
(setq dd (distance pt1 pt2))
(setq ang (angle pt1 pt2))
(setq rr (/ (/ dd (- nn 1)) 2))
(setq nn2 nn)
(repeat nn
(setq bas pt1)
(repeat nn2
(command "circle" bas rr)
(setq bas (polar bas ang (* rr 2)))
)
(setq nn2 (1- nn2))
(setq pt1 (polar pt1 (+ ang (/ (* 60 pi) 180)) (* rr 2)))
)
(entdel en)
(prin1)
)
代码如下。