请教斑竹,如何查找重复点!看看我的程序,数量大就比较慢!(图中的点数目比较多)
<P> aSub mody()<BR>Dim entity As AcadPoint<BR>Dim obj As AcadPoint<BR>Dim xx As Variant<BR>Dim yy As Variant<BR>Dim i As Integer<BR>Dim k As Integer<BR>Dim j As Integer<BR>Dim l As Integer<BR>Dim x As Double<BR>Dim y As Double<BR>Dim a As Double<BR>Dim b As Double<BR>Dim m As Single<BR>m = 0<BR>If ThisDrawing.ModelSpace.Count <> 0 Then<BR> i = ThisDrawing.ModelSpace.Count '图中CAD中的点的总数<BR> k = ThisDrawing.ModelSpace.Count '图中CAD中的点的总数<BR> For j = 0 To i - 1<BR> Set entity = ThisDrawing.ModelSpace.Item(j) '选择一个点<BR> xx = entity.Coordinates '将点的坐标给xx<BR> x = xx(0) '为横坐标值<BR> y = xx(1) '为纵坐标值<BR> For l = k - 1 To j + 1 Step -1<BR> Set obj = ThisDrawing.ModelSpace.Item(l)<BR> yy = obj.Coordinates<BR> a = yy(0)<BR> b = yy(1)<BR> 'MsgBox a & "=" & x<BR> If a = x And b = y Then<BR> entity.color = acBlue '点变色<BR> obj.color = acBlue '点变色<BR> m = m + 1<BR> End If<BR> Next l<BR> Next j<BR> MsgBox m<BR>Else<BR>MsgBox "在模型空间中没有对象存在。"<BR>End If<BR>End Sub</P><P>'请斑竹看看,还有没有其他好的方法来找出图中大量点的程序!</P> <P>既然是点坐标,就可以取出来进行排序。排序后就可以看出哪些是重复的了。</P>
页:
[1]