把autocad保存成R12的DXF格式。程序如下(这是我在使用的程序,绝对没问题)
Private Sub Command1_Click()
Dim a(0 To 100000)
Dim I%, j%, X As String, Y As String, D As String
I = 0
j = 0
'先卸载控件
Do
If Text1.Count > 1 Then
Unload Text1(Text1.Count - 1)
Unload Text2(Text2.Count - 1)
Unload Label3(Label3.Count - 1)
End If
Loop Until Text1.Count = 1
'取出数据
If Dir("d:\" & Text3 & ".dxf") = "" Then
Text1(0) = ""
Text2(0) = ""
Command1.Top = Text1(0).Top + Text1(0).Height + 100 '调整控件位置
Form1.Height = Command1.Top + Command1.Height + 800 '调整窗体大小
Label5.Top = Text1(0).Top + Text1(0).Height + 150
Text3.Top = Text1(0).Top + Text1(0).Height + 150
Exit Sub
End If
Open "d:\" & Text3 & ".dxf" For Input As #1
Do Until EOF(1)
Line Input #1, a(I)
If I > 8 Then
X = Format(a(I - 2), "0.0000")
D = Format(a(I - 8), "0.0000")
Y = Format(a(I), "0.0000")
End If
If D = "POINT" Then '找到定位点
If j > 0 Then '加载控件
Load Text1(j)
Load Text2(j)
Load Label3(j)
Text1(j).Top = Text1(j - 1).Top + Text1(j - 1).Height + 150
Text2(j).Top = Text1(j).Top
Label3(j).Top = Text1(j).Top
Label3(j).Caption = "第" & (j + 1) & "点"
Label3(j).Visible = True
Text1(j).Visible = True
Text2(j).Visible = True
End If
Text1(j) = Mid(X, 1)
Text2(j) = Mid(Y, 1)
j = j + 1
End If
I = I + 1
Loop
Close #1
If j = 0 Then
Text1(0) = ""
Text2(0) = ""
Command1.Top = Text1(0).Top + Text1(0).Height + 100 '调整控件位置
Form1.Height = Command1.Top + Command1.Height + 800 '调整窗体大小