@Anonymous wrote:
.... I want to draw an accurate gear and the guide I linked to seemed to me quite good. The step in the picture is when I get stuck.
It's not something that can be done with just Array, but I think I've got it, based on their description in the two paragraphs just above that image. One thing I think they could be clearer about is this formula:
360° / cpitch * n
which I think should make it clear that it's not
360° / ( cpitch * n)
but rather
( 360° / cpitch ) * n
[at least that's what I used in the code, after trying the other which gave obviously incorrect results]. See whether this does it for you:
(vl-load-com)
(defun C:Tooth (/ cir notch dist steps circ ctr rot inc)
(setq
cir (vlax-ename->vla-object (car (entsel "\nPitch Circle: ")))
notch (car (entsel "\nInitial Notch Polyline: "))
dist (getdist "\nStepping distance of infinite gear: "); [their "successive offset"]
steps (getint "\nNumber of steps in defining tooth: ")
circ (vla-get-Circumference cir); [their C-subscript-pitch]
ctr (vlax-get cir 'Center)
rot (* (/ (* pi 2) circ) dist); rotation per step [their "matching angle around the center"]
inc 0; initially
); setq
(repeat steps
(command
"_.copy" notch "" ctr (polar ctr 0 (* dist (setq inc (1+ inc))))
"_.rotate" "_last" "" ctr (angtos (* rot inc))
); command
); repeat
); defun
It assumes the same orientation as in their images. It requires that square-cornered initial 3-edged notch to be a single Polyline. And it does only one side, so you have to Mirror all the results except the initial one about the midpoint of the initial one's horizontal middle segment. Experiment with the size of the stepping, the number of steps you need to take the shape far enough, etc.
Do it with Osnap turned off. If it works, the usual bells and whistles can be added, it could be made to do both sides, possibly to draw something like a Spline along the results, etc.
Kent Cooper, AIA