- UID
- 187680
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-10-27
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
我的程序运行出错提示:
”运行时错误“5“
无效的过程调用或函数。”
恳请请大侠指正:
Public Sub dattotext()
ThisDrawing.Application.Documents.Add
Dim ptx(0 To 100) As Double
Dim pty(0 To 100) As Double
Dim ptz(0 To 100) As Double
Dim firstPoint(0 To 2) As Double '定义插入点
Dim secondpoint(0 To 2) As Double
Dim trdpoint(0 To 2) As Double
Dim dianshu As Integer
Dim textHeight As Double '定义文本高度
Dim text1 'As String '定义文本字符
Dim text2
Dim text3
Dim textObj As AcadText '定义文本对象
Dim textObj1 As AcadText
Dim textObj2 As AcadText
Open "E:\data\dtt.txt" For Input As #1
n = 1
i = 1
Do Until EOF(1)
Input #1, ptx(i), pty(i), ptz(i)
i = i + 1
dianshu = i - 2
Loop
Close #1
For i = 1 To dianshu
firstPoint(0) = ptx(i) '设定插入点X坐标
firstPoint(1) = -200 '设定插入点Y坐标
firstPoint(2) = 0 '设定插入点Z坐标
secondpoint(0) = ptx(i)
secondpoint(1) = -210
secondpoint(2) = 0
trdpoint(0) = ptx(i)
trdpoint(1) = -220
trdpoint(2) = 0
textHeight = 2.5 '设定文本高度
text1 = pty(i) '设定文本字符
text2 = ptx(i)
text3 = ptz(i)
Set textObj = ThisDrawing.ModelSpace.AddText(text1, firstPoint, textHeight)
Set textObj1 = ThisDrawing.ModelSpace.AddText(text2, secondtPoint, textHeight)
Set textObj2 = ThisDrawing.ModelSpace.AddText(text3, trdpoint, textHeight)
Next i
End Sub
dtt.txt:
40595.850 5.783 27.799
40565.850 5.663 28.369
40535.850 5.543 28.939
40510.850 5.443 29.414
40480.850 5.400 29.984
40450.850 5.400 30.554
40380.850 -0.692 31.591
40260.850 -0.255 32.216
40140.850 2.154 31.869
40070.850 5.317 31.099
40040.850 5.137 30.769
40010.850 4.957 30.439
39980.850 4.789 30.109
39950.850 4.699 29.779
39920.850 4.609 29.449
39890.850 4.519 29.119
39860.850 4.452 28.789
39830.850 4.392 28.459
39800.850 4.332 28.109
39770.850 4.300 27.624
39740.850 4.300 27.114
39710.850 4.300 26.604
39680.850 4.298 26.094
39650.850 4.283 25.584
39620.850 4.268 25.074
39590.850 4.253 24.564
39560.850 4.238 24.054
39530.850 4.222 23.544
39500.850 4.207 23.093
39470.850 4.200 22.816
39440.850 4.200 22.606
39410.850 4.281 22.396
39380.850 4.521 22.186
39350.850 4.761 21.976
39321.000 5.000 21.766
39290.850 5.754 21.556
39238.350 3.332 21.188
39158.350 0.116 20.494
39078.350 2.780 18.779
39025.850 5.061 17.466
38999.400 4.892 16.805
38972.950 4.760 16.144
38942.950 4.610 15.394
38912.950 7.279 14.662
38882.950 5.679 14.083
38856.500 5.645 13.694
38831.500 5.613 13.334
38806.500 4.500 12.974
38781.500 4.500 12.614 |
|