0

我将 Autodesk Inventor 与 Visual Basic 结合使用,并尝试在框中显示一个值。值都显示,除了一个。值 fractionDisplay(thicknessDisplay) 一直在框中显示 3/16(这是我的 fractionDisplay() 数组中的第一个值)。为什么它不会根据设置为 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

如果用户输入 0.5,以下是我得到的结果:

库存编号:PC0003

描述:3/16" X 12" X 5" 100XF BURNOUT

它应该说 1/2" X 12" X 5" 100XF BURNOUT

4

1 回答 1

1

在您读取数组时,您尚未设置厚度显示。

iProperties.Value("Project", "Description") = fractionDisplay(thicknessDisplay) & """" & " X " & Length & """" & " X " & Width & """" & " 100XF BURNOUT"

需要在 Ifs 和 Elseifs 集合之后

于 2017-05-02T16:03:42.213 回答