Hi I found the macro bellow and it claims to draw a involute spur gear but I cannot get it to run. Can anyone advise please?
I have tried opening a part, creating a new macro, pasting the text and then running but nothing happens
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
'----------
R = 71.6034 'ENTER BASE CIRCLE RADIUS
pi = 4 * Atn(1)
For Ang = 0 To 45 Step 2
X1 = Cos(Ang / 180 * pi) * R
Y1 = Sin(Ang / 180 * pi) * R
Opp = R * 2 * pi
Opp = Opp * (Ang / 360)
Hyp = Sqr(R ^ 2 + Opp ^ 2)
Ang2 = Atn(Opp / R)
Ang2 = Ang2 / pi * 180
Ang3 = Ang - Ang2
X2 = Hyp * Cos(Ang3 / 180 * pi)
X2 = Int(X2 * 10000 + 0.5) / 10000
Y2 = Hyp * Sin(Ang3 / 180 * pi)
Y2 = Int(Y2 * 10000 + 0.5) / 10000
XX = X2 / 1000
YY = Y2 / 1000
Part.CreateLine2 X, Y, 0, XX, YY, 0
X = XX
Y = YY
Next Ang
'----------
End Sub
Thanks in anticipation.........
Cameron
SolidworksParts And Features