[求助]选择集始终为空的问题
求助为何我使用SelectByPolygon acSelectionSetWindowPolygon所得到的选择集始终为空呢?Public Sub click3(ByVal PickPoint As Variant)
Dim ss As AcadSelectionSet
Set ss = CreateSelectionSet("ModSet")
Dim i As Integer
Dim k As Integer
Dim j As Integer
Dim pickpt As Variant
On Error Resume Next
ss.SelectAtPoint PickPoint
Dim disptxt As String
If ss.Count > 0 Then
If LCase(ss.Item(0).ObjectName) = LCase("AcDbpolyline") Then
Dim gpnt As Variant
gpnt = ss.Item(0).Coordinates
Dim abc(3) As Double
abc(0) = 0
abc(1) = 1
abc(2) = 2
abc(3) = 3
Dim sss As AcadSelectionSet
Set sss = CreateSelectionSet("rico")
sss.SelectByPolygon acSelectionSetWindowPolygon, gpnt(abc(0))
If sss.Count0 Then
MsgBox disptxt, , "123"
End If
End If
End If
End Sub
那个sss.count一直是0,所以msgbox disptxt,,“123”语句一直无法执行,求解答,谢谢。
注意查看两点:
1.gpnt = ss.Item(0).Coordinates取得的点表是不是都在当前视口内,如果存在点在当前视口外,SelectByPolygon方法选不到目标;
2.gpnt = ss.Item(0).Coordinates取得的点表是不是规范的,如果存在重合的点或所在多边形存在自相交等情况,SelectByPolygon也方法选不到目标;
没有定义fType, fData
Dim fType(0) As Integer, fData(0) As Variant
fType(0) = 0: fData(0) = "DIMENSION"
sSet.Select acSelectionSetAll, , , fType, fData
好像应是三维点
页:
[1]