代码改变世界

AutoCAD LISP花型图案二

2011-03-28 00:00  精诚所至 金石为开  阅读(350)  评论(0编辑  收藏  举报

AutoCAD LISP花型图案二,代码如下。

(defun c:test()
  (setq cen1 (getpoint "\n中心点:"))
  (setq rr2 (getdist cen1 "\n小圆半径:"))
  (command "circle" cen1 rr2)
  (setq rr (getdist cen1 "\n大圆半径:"))
  (setq nn (getint "\n等分数<10>:"))
  (if (null nn) (setq nn 10))
  (setq ang (/ pi nn 0.5))
  (setq bas (polar cen1 0 rr2))
  (setq pt1 (polar cen1 0 rr))
  (setq pt2 (polar cen1 ang rr))
  (command "pline" bas pt1 "a" "a" 180 pt2 "")
  (command "array" (entlast) cen1 "" "p" cen1 nn "" "")
  (prin1)
  )

代码完。