胡说 发表于 2006-1-19 21:28:00

[VBA]求助:怎么选择集中的总数和实际总数对不上呢??

   On Error Resume Next
    Set ssetObj = ThisDrawing.SelectionSets.Add("SSET_OBJ")
    If Err Then
      Err.Clear
      Set ssetObj = ThisDrawing.SelectionSets("SSET_OBJ")
    End If
   
    ' Add objects to a selection set by prompting user to select on the screen
'    ssetObj.Clear
    ssetObj.Clear
    FilterType(0) = 0
    FilterData(0) = "CIRCLE"
    ssetObj.SelectOnScreen FilterType, FilterData
    sngSum = ssetObj.Count
通过以上代码选中的16个圆,而sngSum却等于50??

wylong 发表于 2006-1-26 15:45:00

可能你的<STRONG><U><FONT color=#f70909>圆有重复的,表面看到的是16,而实际存在的就是50个,你在检查一下</FONT></U></STRONG>

MJTD_7777 发表于 2006-2-5 17:05:00

Sub mm()
On Error Resume Next
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SSET_OBJ")
    If Err Then
      Err.Clear
      Set ssetObj = ThisDrawing.SelectionSets("SSET_OBJ")
    End If
    On Error GoTo 0
    ' Add objects to a selection set by prompting user to select on the screen
'    ssetObj.Clear
    ssetObj.Clear
    Dim FilterType(0)As Integer, FilterData(0)As Variant
    FilterType(0) = 0
    FilterData(0) = "CIRCLE"
    ssetObj.SelectOnScreen FilterType, FilterData
    sngSum = ssetObj.Count
End Sub
页: [1]
查看完整版本: [VBA]求助:怎么选择集中的总数和实际总数对不上呢??