谢谢版主, 我修改了下,加上(command "zoom" "o" ss "")就行,不加上这的话好像有时要出错,不知道为什么 (defun c:xt11() (setvar "cmdecho" 0) (setvar "OSMODE" 0) (setq cen1 (getpoint"\n请输入基准点:")) (setq rr (getdist cen1 "\n请输入大圆半径:")) (command "circle" cen1 rr) (setq en1 (entlast)) (setq cen2 (polar cen1 0 rr)) (setq rr1 (getdist"\n请输入轮齿半径:")) (setq nn1 (getint"\n请输入滚轮齿数<5>:")) (if(null nn1) (setq nn1 5)) (setq ang 0 ss (ssadd)) (setq ang1 (/ pi 0.5 nn1)) ;;绘制小圆 (repeat nn1 (command "CIRCLE" cen2 rr1) (setq ss (ssadd (entlast) ss)) (setq ang (+ ang ang1)) (setq cen2 (polar cen1 ang rr)) ) (command "zoom" "o" ss "") ;;修剪小圆 (setq ang 0) (repeat nn1 (command "trim" "" (polar cen1 ang (- rr rr1)) "") (setq ang (+ ang ang1)) ) ;;修剪大圆 (setq ang 0) (repeat nn1 (command "trim" ss "" (polar cen1 ang rr) "") (setq ang (+ ang ang1)) ) (command "circle" cen1 (* rr 0.5)) (setvar "OSMODE" 1) (setvar "cmdecho" 1) (prin1) ) |