看看你的控制变量n就知道了,稍微改了一下:
(defun c:mp ( / p l n d h ) (command "osnap" "off") ;关闭捕捉功能 (setq p (getpoint "\n输入起点:") l (GETDIST "\n输入宽度(X方向):") h (GETDIST "\n输入高度(Y方向):") n (GETINT "\n输入点数(X方向):") m (getint "\n输入点数(Y方向):") dx (/ l n) dy (/ h m) px p py p ) (setq n2 n) (setq r (GETDIST "\n输入点半径(需大于零):")) ;确定点半径大小,带纠错 (while (< r 0) (setq r (getreal "\n请重新输入点半径(需大于零)")) ) (while (>= m 0) (command "line" py (polar py 0 l) "") ;画线用来查看是否正确 (while (>= n 0) ;循环开始 (command "donut" 0 r px "") (setq px (polar px 0 dx)) (setq n (- n 1)) ) (setq n n2) (setq py (polar py (/ pi 2) dy)) (setq m (- m 1)) (setq px py) ) ) |