- 积分
- 17084
- 明经币
- 个
- 注册时间
- 2003-2-26
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-5-24 00:44:00
|
显示全部楼层
这是我写的全站仪展点程序,你参考一下吧!
Dim i As Integer
On Error Resume Next
Dim textline(5000)
Dim ds As Integer
Dim s As Integer
Dim pnt(0 To 2) As Double
Dim tpnt(0 To 2) As Double
Dim pntobj As AcadPoint
Dim dm As AcadText
'Dim us1 As String
Dim us2 As String
Dim us3 As String
Dim ur5 As String
i = 1 '初始值
CommonDialog1.ShowOpen
Open CommonDialog1.FileName For Input As #1
If CommonDialog1.FileName = "" Then Exit Sub
ProgressBar1.Visible = True
'Me.hide
Do While Not EOF(1)
'读取坐标数据
Input #1, textline(i)
i = i + 1
Loop
Label1.Caption = i '读取终值
Close #1
'总点数
ds = textline(1) - 1
'进度条初始设置
ProgressBar1.Min = 1
ProgressBar1.Max = ds
us2 = ThisDrawing.GetVariable("userr2")
us3 = ThisDrawing.GetVariable("userr3")
ur5 = ThisDrawing.GetVariable("userr5")
If ThisDrawing.GetVariable("useri5") <> 666 Then
ThisDrawing.SetVariable "useri5", 666
End If
'读取数据
For s = 0 To ds
ProgressBar1.Value = s '进度条取值
'点坐标
Select Case us1
Case 500
If us2 = 0 And us3 = 0 Then '0,0的情况
pnt(0) = (textline(5 * s + 4)) * 2 + 100
pnt(1) = (textline(5 * s + 5)) * 2 + 100
pnt(2) = textline(5 * s + 6)
ElseIf us2 = 100 And us3 = 100 Then '100,100的情况
pnt(0) = (textline(5 * s + 4)) * 2 - 100
pnt(1) = (textline(5 * s + 5)) * 2 - 100
pnt(2) = textline(5 * s + 6)
End If
Case 1000
If us2 = 0 And us3 = 0 Then '0,0的情况
pnt(0) = textline(5 * s + 4) + 100
pnt(1) = textline(5 * s + 5) + 100
pnt(2) = textline(5 * s + 6)
ElseIf us2 = 100 And us3 = 100 Then '100,100的情况
pnt(0) = textline(5 * s + 4)
pnt(1) = textline(5 * s + 5)
pnt(2) = textline(5 * s + 6)
End If
End Select
'**********
'点名坐标
tpnt(0) = pnt(0) + 1
tpnt(1) = pnt(1)
tpnt(2) = 0
'创建点
Set pntobj = ThisDrawing.ModelSpace.AddPoint(pnt) '点位
Set dm = ThisDrawing.ModelSpace.AddText(textline(5 * s + 2), tpnt, 2) '点名
Next
Me.hide
ProgressBar1.Visible = False
MsgBox "展点完成"
ThisDrawing.Application.ZoomExtents '缩放全图 |
|