求助 桩号 设计高程 提取问题
有两个数组,分别都已赋值成功,为何在后续的提取过程中出错甚至没有值?有问题的两个数组为ZHG() SJG()
代码如下:
Open "zuobiao.txt" For Append As #1
ReDim ents(SS1.Count) As String
ReDim ZHG(SS1.Count) As String
ReDim SJG(SS1.Count) As Integer
Dim pos As Integer
Dim cp As Integer
Dim zp As Integer
Dim x0p As Integer
'----------------------------------------存储设计高程 (每个桩号下中心线处)
cp = 0
For i = 0 To SS1.Count - 1
ents(i) = SS1.Item(i).TextString
zb = SS1.Item(i).InsertionPoint
zzbi = Format(zb(0), "0.000")
'zzbi = Format(zb(0), "0.000" + zb(1), "0.000" + zb(2), "0.000")
If Abs(zzbi) = 0.46 Then
cp = cp + 1
SJG(i) = ents(i)
'Print #1, i, cp, Format(SJG(i), "000.00000") '------------------获得是设计高程zzbi
Else
End If
Next
'-------------------------------------------存储桩号(每个断面)
zp = 0
For j = 0 To SS1.Count - 1
pos = InStr(ents(j), "K")
If pos = 1 Then
zp = zp + 1
ZHG(j) = ents(j)
' Print #1, j, zp, ZHG(j) '------------------获得是桩号
Else
End If
Next
'------------------------------------------取出桩号,设计高程
For x0p = 0 To zp - 1
Print #1, x0p, ZHG(xj), Format(SJG(xj), "000.00000")
Next
'对象处理
ErrorHandle:
acadDoc.SelectionSets.Item("selectset1").Delete '删除选择集
Close #1
End Sub
本帖最后由 syx2014 于 2014-9-16 10:37 编辑
正确的提取结果应该为上图所示
问题解决了
页:
[1]