51
VB and the development of wizards / Trouble with a trigonometry calculation in VB?
« on: September 06, 2007, 05:41:07 PM »
Hi guys I'm attempting to make a small calculator to go on one of the pages, I tried to make this myself, but it doesn't quite work properly......it's so close, it just doesn't calculate correctly, I think it's got to do with how it calculates as Radians not degrees:
Lead=PI*Ø/Tan of Angle
Here's what I have so far.
Angle=GetUserDRO(1201)'read angle
Ø=GetUserDRO(1202)'read Ø
SetOEMDRO (1203,0)'Set DRO 1203 to 0
Radians=Tan(Angle)
Degrees=(Radians*180)/3.141592654
If GetUserDRO(1201) Then
If GetUserDRO(1202) Then
Message "O.K Parameter"
SetOEMDRO (1203,3.141592654*Ø/Tan(Degrees))'Set DRO 1203 to Answer
Else
Message "Invalid Parameter"
End If
Else
Message "Invalid Parameter"
End If
Thanks guys.
Lead=PI*Ø/Tan of Angle
Here's what I have so far.
Angle=GetUserDRO(1201)'read angle
Ø=GetUserDRO(1202)'read Ø
SetOEMDRO (1203,0)'Set DRO 1203 to 0
Radians=Tan(Angle)
Degrees=(Radians*180)/3.141592654
If GetUserDRO(1201) Then
If GetUserDRO(1202) Then
Message "O.K Parameter"
SetOEMDRO (1203,3.141592654*Ø/Tan(Degrees))'Set DRO 1203 to Answer
Else
Message "Invalid Parameter"
End If
Else
Message "Invalid Parameter"
End If
Thanks guys.