AutoLISP语言画同心圆
程序员文章站
2024-03-18 13:09:34
...
两个程序,第一个利用while循环体
(defun c:concentric_circle()
(setvar "cmdecho" 0)
(setq p (getpoint "\n 输入圆心点:"))
(setq n (getdist "\n 输入圆的个数:"))
(setq i 1)
(while (<= i n)
(if(= i 1)
(progn
(setq r (getdist "\n 请输入圆的半径:") )
(command "circle" p r ""))
(progn
(setq r (getdist "\n 请输入下个圆的半径:") )
(command "circle" p r "")
)
)
(setq i (1+ i))
)
(setvar "cmdecho" 1)
(princ)
)
第二个利用repeat循环
(defun c:concentric_circle2()
(setvar "cmdecho" 0)
(setq p (getpoint "\n 输入圆心点:"))
(setq n (getint "\n 输入圆的个数:"))
(repeat n
(setq r (getdist "\n 请输入圆的半径:") )
(command "circle" p r "")
)
(setvar "cmdecho" 1)
(princ)
)
上一篇: mybatis使用foreach遍历时同时遍历key和value
下一篇: emacs学习笔记