rico2005 发表于 2009-3-5 23:41:00

[求助]选择集始终为空的问题

求助为何我使用SelectByPolygon acSelectionSetWindowPolygon所得到的选择集始终为空呢?<br/><br/>Public Sub click3(ByVal PickPoint As Variant)<br/><br/>Dim ss As AcadSelectionSet<br/>Set ss = CreateSelectionSet("ModSet")<br/><br/>Dim i As Integer<br/>Dim k As Integer<br/>Dim j As Integer<br/><br/>Dim pickpt As Variant<br/>On Error Resume Next<br/>    <br/>ss.SelectAtPoint PickPoint<br/>Dim disptxt As String<br/><br/>If ss.Count &gt; 0 Then<br/>    If LCase(ss.Item(0).ObjectName) = LCase("AcDbpolyline") Then<br/>    <br/>Dim gpnt As Variant<br/>gpnt = ss.Item(0).Coordinates<br/>Dim abc(3) As Double<br/>abc(0) = 0<br/>abc(1) = 1<br/>abc(2) = 2<br/>abc(3) = 3<br/>Dim sss As AcadSelectionSet<br/>Set sss = CreateSelectionSet("rico")<br/><br/>sss.SelectByPolygon acSelectionSetWindowPolygon, gpnt(abc(0))<br/>If sss.Count &lt;&gt; 0 Then<br/>MsgBox disptxt, , "123"<br/>End If<br/><br/> End If<br/>End If<br/><br/>End Sub<br/><br/>那个sss.count一直是0,所以msgbox disptxt,,“123”语句一直无法执行,求解答,谢谢。<br/>

王咣生 发表于 2009-3-8 20:24:00

<p>注意查看两点:</p><p>1.gpnt = ss.Item(0).Coordinates取得的点表是不是都在当前视口内,如果存在点在当前视口外,SelectByPolygon方法选不到目标;</p><p>2.gpnt = ss.Item(0).Coordinates取得的点表是不是规范的,如果存在重合的点或所在多边形存在自相交等情况,SelectByPolygon也方法选不到目标;</p>

兰州人 发表于 2009-3-9 11:50:00

<p>&nbsp;没有定义fType, fData</p><p>&nbsp;&nbsp;&nbsp;&nbsp; Dim fType(0) As Integer, fData(0) As Variant<br/>&nbsp;&nbsp;&nbsp;&nbsp; fType(0) = 0: fData(0) = "DIMENSION"<br/>&nbsp;&nbsp;&nbsp;&nbsp; sSet.Select acSelectionSetAll, , , fType, fData</p>

542392339 发表于 2010-1-6 17:36:00

好像应是三维点
页: [1]
查看完整版本: [求助]选择集始终为空的问题