I am trying to use this code to exit a loop if an input angle is 90. The code does not do this but the frustrating part is that while I don't have anything exactly the same in the rest of my code I have used the same format if statement successfully. I have also successfully used Exit For. I am a little lost. Here is the code I am referring to.
If Not (Angle = 90) Then
Exit For
End If
Here is the more code if it helps
For i = -cntr * 2 + cntrshift To cntr * 2 + cntrshift Step 1
If Not (Angle = 90) Then
Exit For
End If
'1
x11 = 0
x21 = pL
y11 = i * yshift
y21 = i * yshift + Tan(Angle) * pL
'2
x12 = 0
x22 = 0
y12 = i * yshift
y22 = i * yshift - tW / Cos(Angle)
'3
x13 = 0
x23 = pL
y13 = i * yshift - tW / Cos(Angle)
y23 = i * yshift - tW / Cos(Angle) + Tan(Angle) * pL
'4
x14 = pL
x24 = pL
y14 = i * yshift + Tan(Angle) * pL
y24 = i * yshift - tW / Cos(Angle) + Tan(Angle) * pL
Set line2D3 = factory2D1.CreateLine(x11, y11, x21, y21)
Set line2D4 = factory2D1.CreateLine(x12, y12, x22, y22)
Set line2D5 = factory2D1.CreateLine(x13, y13, x23, y23)
Set line2D6 = factory2D1.CreateLine(x14, y14, x24, y24)
Next
'If the angle is 90 this should create the layer
For l = cntrshift To cntr3 Step 1
If (Angle <> 90) Then
Exit For
End If
'1
x11 = l * tW * (sT + 1) + shift * tW
x21 = x11
y11 = pW
y21 = 0
'2
x12 = x11
x22 = x11 + tW
y12 = 0
y22 = 0
'3
x13 = x11 + tW
x23 = x13
y13 = 0
y23 = pW
'4
x14 = x11 + tW
x24 = x11
y14 = pW
y24 = pW
Set line2D3 = factory2D1.CreateLine(x11, y11, x21, y21)
Set line2D4 = factory2D1.CreateLine(x12, y12, x22, y22)
Set line2D5 = factory2D1.CreateLine(x13, y13, x23, y23)
Set line2D6 = factory2D1.CreateLine(x14, y14, x24, y24)
Next
Aucun commentaire:
Enregistrer un commentaire