[VBA]求助!用VBA提取CAD中实体段信息
我是新手,求助高手帮忙指点一下,我的代码在VBA编辑器里运行老是出现错误(红色字体部分),我感觉语法上没有什么错误,但是每次运行都出错,找不出原因,整了好久!希望哪位大侠帮忙指点一下,万分感激!!!Sub CommandButton1_Click()
Dim A As String
Dim B As String
Dim CC As ENTITIES_Type
Dim i, il As Integer
Open "e:\vba\1.DXF" For Input As #1
Do While B = "ENTITIES"
Input #1, B
Loop
Seek #1, Seek(1)
Do While Not EOF(1)
Input #1, B
Loop
Do Input #1,B
Loop Until B <>"0"
i = i + 1
Select Case B
Case "LINE"
CC.Style = "line"
CC.X1 = Str$(X1)
CC.Z1 = Str$(Z1)
CC.X2 = Str$(X2)
CC.Z2 = Str$(Z2)
xx1 = X2
Case "ARC"
CC.Style = "ARC"
CC.X1 = Str$(X1)
CC.Z1 = Str$(Z1)
CC.X2 = Str$(X2)
CC.Z2 = Str$(Z2)
CC.X3 = Str$(X3)
CC.Z3 = Str$(Z3)
CC.R = Str$(R)
CC.ANGLE1 = Str$(ANGLE1)
CC.ANGLE2 = Str$(ANGLE2)
If Abs(X1 - xx1) > 0.5 Then
CC.WISE = "0"
A = CC.X1: CC.X1 = CC.X2: CC.X2 = A
A = CC.Z1: CC.Z1 = CC.Z2: CC.Z2 = A
A = CC.ANGLE1: CC.ANGLE1 = CC.ANGLE2: CC.ANGLE2 = A
Else: CC.WISE = "1"
End If
xx1 = X2
Case "CIRCLE"
il = il + 1
CC.Style = "CIRCLE"
CC.X1 = Str$(X1)
CC.Z1 = Str$(Y1)
CC.R = Str$(R1)
CC.X2 = CC.Z1
xx1 = X1
Case Else
CC.Style = "NONE"
End Select
Seek #1, Seek(1)
j = Str$(i)
Close #1
End Sub
补充一点,如果把红色字体部分删除后,就可以运行了,不过如果删除了,那么我提取出来的应该就不只是实体段的信息了。困惑!
页:
[1]