谢谢明总!
我试了下,还是搞不定,不知问题出在哪里,帮忙看看。
下面是模块里的代码:
Public Sub CreateSSetFilter(ByRef filterType As Variant, ByRef filterData As Variant, ParamArray filter()) 'MsgBox UBound(filter) If UBound(filter) Mod 2 = 0 Then MsgBox "filter参数无效!" Exit Sub End If Dim fType() As Integer Dim fData() As Variant Dim count As Integer count = (UBound(filter) + 1) / 2 ReDim fType(count - 1) ReDim fData(count - 1) Dim i As Integer For i = 0 To count - 1 fType(i) = filter(2 * i) fData(i) = filter(2 * i + 1) Next i filterType = fType filterData = fData End Sub
下面是Thisdrawing中的代码:
Public Sub FilterSSet() On Error Resume Next Dim SSet As AcadSelectionSet If Not IsNull(ThisDrawing.SelectionSets.Item("Example")) Then Set SSet = ThisDrawing.SelectionSets.Item("Example") SSet.Delete End If Set SSet = ThisDrawing.SelectionSets.Add("Example") Dim fType As Variant, fData As Variant Call CreateSSetFilter(fType, fData, 2, "*D*", 8, "0") SSet.Select acSelectionSetAll, , , fType, fData MsgBox SSet.count SSet.Delete End Sub
测试结果 显示 为 0
|