我正在尝试从数组中提取一个值,但它只提取第一个值,我不确定为什么?
I'm trying to pull a value from an array but it's only pulling the first value and I'm not sure why?
我将 Autodesk Inventor 与 Visual Basic 结合使用,并尝试在框中显示一个值。除一个值外,所有值都显示。值 fractionDisplay(thicknessDisplay) 在框中一直显示 3/16(这是我的 fractionDisplay() 数组中的第一个值)。为什么它不显示基于 thicknessDisplay 数字设置为 0 以外的任何值的其他值?
这是我的代码:
Dim erpNumber() As String = {"PA0001", "PA0002", "PA0003", "PA0004", "PA0006", "PC0003", "PC0004", "PC0005", "PC0006", "PC0007", "PC0008", "PC0009", "PC0010", "PC0011"}
Dim fractionDisplay() As String = {"3/16", "1/4", "5/16", "3/8", "1/8", "1/2", "5/8", "3/4", "1", "1 1/4", "1 1/2", "2", "2 1/2", "3"}
stockNumberValue = erpNumber(plateThickness)
iProperties.Value("Project", "Description") = fractionDisplay(thicknessDisplay) & """" & " X " & Length & """" & " X " & Width & """" & " 100XF BURNOUT"
If Thickness = 0.1875 Then
plateThickness = 0
thicknessDisplay = 0
ElseIf Thickness = 0.25 Then
plateThickness = 1
thicknessDisplay = 1
ElseIf Thickness = 0.3125 Then
plateThickness = 2
thicknessDisplay = 2
ElseIf Thickness = 0.375 Then
plateThickness = 3
thicknessDisplay = 3
ElseIf Thickness = 0.125 Then
plateThickness = 4
thicknessDisplay = 4
ElseIf Thickness = 0.5 Then
plateThickness = 5
thicknessDisplay = 5
ElseIf Thickness = 0.625 Then
plateThickness = 6
thicknessDisplay = 6
ElseIf Thickness = 0.75 Then
plateThickness = 7
thicknessDisplay = 7
ElseIf Thickness = 1 Then
plateThickness = 8
thicknessDisplay = 8
ElseIf Thickness = 1.25 Then
plateThickness = 9
thicknessDisplay = 9
ElseIf Thickness = 1.5 Then
plateThickness = 10
thicknessDisplay = 10
ElseIf Thickness = 2 Then
plateThickness = 11
thicknessDisplay = 11
ElseIf Thickness = 2.5 Then
plateThickness = 12
thicknessDisplay = 12
ElseIf Thickness = 3 Then
plateThickness = 13
thicknessDisplay = 13
End If
stockNumberValue = erpNumber(plateThickness)
iProperties.Value("Project", "Stock Number") = stockNumberValue
以下是用户输入 .5 时我得到的结果:
库存编号:PC0003
描述:3/16" X 12" X 5" 100XF BURNOUT
应该是 1/2" X 12" X 5" 100XF BURNOUT
在您读取数组时,您还没有设置 thicknessDisplay。
iProperties.Value("Project", "Description") = fractionDisplay(thicknessDisplay) & """" & " X " & Length & """" & " X " & Width & """" & " 100XF BURNOUT"
需要在 Ifs 和 Elseifs 的集合之后
我将 Autodesk Inventor 与 Visual Basic 结合使用,并尝试在框中显示一个值。除一个值外,所有值都显示。值 fractionDisplay(thicknessDisplay) 在框中一直显示 3/16(这是我的 fractionDisplay() 数组中的第一个值)。为什么它不显示基于 thicknessDisplay 数字设置为 0 以外的任何值的其他值?
这是我的代码:
Dim erpNumber() As String = {"PA0001", "PA0002", "PA0003", "PA0004", "PA0006", "PC0003", "PC0004", "PC0005", "PC0006", "PC0007", "PC0008", "PC0009", "PC0010", "PC0011"}
Dim fractionDisplay() As String = {"3/16", "1/4", "5/16", "3/8", "1/8", "1/2", "5/8", "3/4", "1", "1 1/4", "1 1/2", "2", "2 1/2", "3"}
stockNumberValue = erpNumber(plateThickness)
iProperties.Value("Project", "Description") = fractionDisplay(thicknessDisplay) & """" & " X " & Length & """" & " X " & Width & """" & " 100XF BURNOUT"
If Thickness = 0.1875 Then
plateThickness = 0
thicknessDisplay = 0
ElseIf Thickness = 0.25 Then
plateThickness = 1
thicknessDisplay = 1
ElseIf Thickness = 0.3125 Then
plateThickness = 2
thicknessDisplay = 2
ElseIf Thickness = 0.375 Then
plateThickness = 3
thicknessDisplay = 3
ElseIf Thickness = 0.125 Then
plateThickness = 4
thicknessDisplay = 4
ElseIf Thickness = 0.5 Then
plateThickness = 5
thicknessDisplay = 5
ElseIf Thickness = 0.625 Then
plateThickness = 6
thicknessDisplay = 6
ElseIf Thickness = 0.75 Then
plateThickness = 7
thicknessDisplay = 7
ElseIf Thickness = 1 Then
plateThickness = 8
thicknessDisplay = 8
ElseIf Thickness = 1.25 Then
plateThickness = 9
thicknessDisplay = 9
ElseIf Thickness = 1.5 Then
plateThickness = 10
thicknessDisplay = 10
ElseIf Thickness = 2 Then
plateThickness = 11
thicknessDisplay = 11
ElseIf Thickness = 2.5 Then
plateThickness = 12
thicknessDisplay = 12
ElseIf Thickness = 3 Then
plateThickness = 13
thicknessDisplay = 13
End If
stockNumberValue = erpNumber(plateThickness)
iProperties.Value("Project", "Stock Number") = stockNumberValue
以下是用户输入 .5 时我得到的结果:
库存编号:PC0003
描述:3/16" X 12" X 5" 100XF BURNOUT
应该是 1/2" X 12" X 5" 100XF BURNOUT
在您读取数组时,您还没有设置 thicknessDisplay。
iProperties.Value("Project", "Description") = fractionDisplay(thicknessDisplay) & """" & " X " & Length & """" & " X " & Width & """" & " 100XF BURNOUT"
需要在 Ifs 和 Elseifs 的集合之后