- 积分
- 17084
- 明经币
- 个
- 注册时间
- 2003-2-26
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
今天写了一程序,是查找图中的扩展数据的,第一次运行很快就查找出来了,后面多运行几次以后,查找所花的时间就越来越长,请大家帮我看看是怎么回事???原代码如下:
Option Explicit
Sub djfind()
On Error Resume Next
'On Error GoTo err
Dim zdh As String
Dim Xdatatype As Integer
Dim Xdatavalue As Variant
Dim lsset As AcadSelectionSet
Dim entity As AcadEntity
Dim i As Integer
'If ThisDrawing.SelectionSets.Count > 0 Then
' For i = 0 To ThisDrawing.SelectionSets.Count - 1
' ThisDrawing.SelectionSets.Item(i).Clear
' ThisDrawing.SelectionSets.Item(i).Delete
' Next
'End If
Dim Fdata(1) As Variant
Dim Ftype(1) As Integer
Ftype(0) = 0
Fdata(0) = "Line"
Ftype(1) = 39
Fdata(1) = 1500088
Set lsset = ThisDrawing.SelectionSets.Add("lsset")
lsset.Select acSelectionSetAll, , , Ftype, Fdata
zdh = ThisDrawing.Utility.GetString(1, vbCr & "输入宗地号:")
Dim lspnt As Variant
Dim lepnt As Variant
For Each entity In lsset
entity.GetXData "", Xdatatype, Xdatavalue
Select Case Xdatavalue(4)
Case zdh
lspnt = entity.StartPoint
lepnt = entity.EndPoint
MsgBox "找到"
ThisDrawing.Application.ZoomWindow lspnt, lepnt
lsset.Clear
lsset.Delete
Exit Sub
End Select
Next
End Sub |
|