(vl-load-com)
(if (and
(setq p1 (getpoint "\n请选择同心圆圆心"))
(setq r1 (s180828a p1 "\n请输入第一个同心圆半径:"))
(setq r2 (s180828a p1 "\n请输入第二个同心圆半径:"))
(setq r3 (s180828a p1 "\n请输入第三个同心圆半径:"))
(setq p2 (polar p1 0 (setq r4 (cadr (setq ss1 (vl-sort (list r1 r2 r3) '<))))))
(setq r (s180828a p2 "\n请输入小圆半径"))
(setq n (s180828s))
)
(progn
(setq ss2 '())
(while (setq r1 (car ss1))
(setq ss1 (cdr ss1))
(entmake (list '(0 . "CIRCLE") (cons 10 p1) (cons 40 r1)))
(setq ss2 (cons (entlast) ss2))
)while
(setq i -1.0)
(while (< (setq i (1+ i)) n)
(setq p2 (polar p1 (/ (* pi i 2) n) r4))
(entmake (list '(0 . "CIRCLE") (cons 10 p2) (cons 40 r)))
)while
)
)
(princ)
)autolisp程序,复制到记事本,以【.lsp】为后缀命名,AutoCAD命令【appload】加载。
输入圆半径
(defun s180828a (p1 str1 / p1 str1)
(initget 6)
(getdist p1 str1)
)
输入小圆数量
(defun s180828s ()
(initget 6)
(getint "\n请输入小圆数量:")
)
(defun c:drawing()(setvar "cmdecho" 0)
(setq ptcenter (getpoint "\n请输入圆心位置:"))
(setq dist(getdist "\n请输入基圆半径:"))
(command "_circle" ptcenter dist)
(command "_circle" ptcenter (* dist 1.2) )
(command "_circle" ptcenter (* dist 1.2 1.2) )
(command "_circle" ptcenter (* dist 1.2 1.2 1.2) )
(princ)
)
再保存为drawing.lsp就OK了...
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)