Sketching Angled Lines (degrees - integer increments)

Hello all,

Would one of you please assist me in sketching lines in exact degrees (integers 0 to 180)? The output is angles that are not consistently integers. Here is the code I'm currently utilizing:

Function SketchAngleLinesInUpperHalf(ByVal Diameter As Double)

    'Input Units are Inches

    Dim i As Integer

    Dim R As Double

    Dim pi As Double

    Dim Xcord As Double

    Dim Ycord As Double

    pi = Atn(1) * 4

    R = Diameter / 2

   

    For i = 0 To 180

        Xcord = R * Cos(i * pi / 180)

        Ycord = R * Sin(i * pi / 180)

        Set swSketchSegment = swSketchMgr.CreateLine(0, 0, 0, Xcord, Ycord, 0)

    Next

End Function

How can I get the angle of each line to be an integer?

Thanks,

Nick

SolidworksApi macros