Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can someone help me debug this code? I could not for the life of me figure out why this 'if statement' won't work
I have checked the output value of 'Ang2' through the 'Z2' output in the parameter and have confirmed that it is in fact equal to 90. So I can't figure out why the code thinks the "sharedVariable("Ang2")" does not equal 90 when in fact it does.
I added the ipt part model to this code that is being tested.
Dim oParams As Parameters
oParams=ThisDoc.Document.ComponentDefinition.Parameters
Dim oUserParams As UserParameters
oUserParams=oParams.UserParameters
sharedVariable("A") = Measure.ExtentsLength
sharedVariable("B") = Measure.ExtentsWidth
sharedVariable("C") = Measure.ExtentsHeight
sharedVariable("Ang1") = Measure.Angle("Large Face", "XZ Plane")
sharedVariable("Ang2") = Measure.Angle("Large Face", "XY Plane")
sharedVariable("Ang3") = Measure.Angle("Large Face", "YZ Plane")
X1 = sharedVariable("A")
X2 = sharedVariable("B")
X3 = sharedVariable("C")
Z1 = sharedVariable("Ang1")
Z2 = sharedVariable("Ang2")
Z3 = sharedVariable("Ang3")
If sharedVariable("Ang1") >=0 And sharedVariable("Ang2") = 90 Then
Try
oUserParams("G_L").Value = (sharedVariable("A")/Cos(sharedVariable("Ang1")*PI/180)*2.54)
Catch
' assume error means not found and create it
oUserParams.AddByValue("G_L", (sharedVariable("A")/Cos(sharedVariable("Ang1")*PI/180)*2.54), kInchLengthUnits)
End Try
Else
End If
iLogicVb.UpdateWhenDone = True
Solved! Go to Solution.