(defun c:gear(/)
(
setq
p0 (getpoint"输入齿轮中心p0: ")
m (getreal"输入齿轮模数M: ")
z (getint"输入齿轮齿数Z: ")
ha 1
c 0.25
a (/ pi 9)
ra(/ (* (+ z (+ ha ha)) m) 2)
rf(/ (* (- z (+ (+ ha ha) c)) m) 2)
r(/ ( * m z) 2)
rb ( * r (cos a))
ri rb
ang 0
g (polar p0 ang rb)
)
(command "circle" p0 ra)
(command "circle" p0 rf)
(command "circle" p0 r)
(command "line" g)
(while (< ri ra)
(setq
ang ( + ang(/ pi 360))
ri ( / rb (cos ang))
cta ( - (/ (sin ang) (cos ang)) ang)
g(polar p0 cta ri)
)