代码改变世界

AutoCAD LISP 绘制贝壳曲线

2011-03-27 23:22  精诚所至 金石为开  阅读(543)  评论(0编辑  收藏  举报

AutoCAD LISP 绘制贝壳曲线,代码如下。

(defun c:test()
  (setq pt1 (getpoint "\n基准点:"))
  (setq pt2 (getpoint "\n圆半径点:"))
  (setq cir_d (* 2 (distance pt1 pt2)))
  (setq ang (angle pt1 pt2))
  (setq dd (getdist pt1 "\n圆间距:"))
  (setq nn (getint "\n重复次数<10>:"))
  (if (null nn) (setq nn 10))
  (setq cc 1)
  (repeat nn
    (setvar "cecolor" (rtos cc 2 0))
    (setq pt2 (polar pt1 ang cir_d))
    (command "circle" "2p" pt1 pt2)
    (setq cir_d (+ cir_d dd))
    (setq cc (+ 1 cc))
    )
  (setvar "cecolor" "bylayer")
  (prin1)
  )

代码完。