AutoLISP绘制花型四
2011-03-28 17:32 精诚所至 金石为开 阅读(312) 评论(0) 编辑 收藏 举报AutoLISP绘制花型四,像个荷花的形状,代码如下。
(defun c:test()
(setvar "cmdecho" 0)
(setq os (getvar "osmode"))
(setvar "osmode" 0)
(setq cen (getpoint "\n中心点:"))
(setq srr (getvar "circlerad"))
(setq str_rr (strcat "\n圆半径<" (rtos srr 2) ">:"))
(setq rr (getdist cen str_rr))
(if (null rr) (setq rr srr))
(command "circle" cen rr)
(setq nn (getint "\n输入偶数多边形<6>:"))
(if (null nn) (setq nn 6))
(if (= (rem nn 2) 0)
(progn
(setq ang1 (/ pi (/ nn 2)))
(setq ang2 (- (/ pi (/ nn 2))))
(setq pt1 (polar cen ang1 rr))
(setq pt2 (polar cen ang2 rr))
(if (= nn 4)
(progn
(setq pt1 (polar cen (/ pi 4) rr))
(setq pt2 (polar cen (- (/ pi 4)) rr))
)
)
(command "arc" pt1 cen pt2)
(command "array" (entlast) "" "p" cen nn "" "")
)
(alert "错误,请输入偶数……")
)
(setvar "osmode" os)
(prin1)
)
代码完。
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)