没有试过怎么会知道不能选取呢?
选择集中对于全图的那个选项(acSelectionSetAll)与图层的状态无关。
看看示例吧:
- Sub GetBlkRef()
- Dim ss As AcadSelectionSet
- Set ss = CreateSelectionSet
- Dim tFilter As Variant
- Dim dFilter As Variant
- BuildFilter tFilter, dFilter, 0, "Insert"
- ss.Select acSelectionSetAll, , , tFilter, dFilter
- Debug.Print ss.Count
- End Sub
- Public Function CreateSelectionSet(Optional ssName As String = "ss") As AcadSelectionSet
- Dim ss As AcadSelectionSet
-
- On Error Resume Next
- Set ss = ThisDrawing.SelectionSets(ssName)
- If Err Then Set ss = ThisDrawing.SelectionSets.Add(ssName)
- ss.Clear
- Set CreateSelectionSet = ss
- End Function
- Public Sub BuildFilter(typeArray, dataArray, ParamArray gCodes())
- Dim fType() As Integer, fData()
- Dim index As Long, i As Long
-
- index = LBound(gCodes) - 1
-
- For i = LBound(gCodes) To UBound(gCodes) Step 2
- index = index + 1
- ReDim Preserve fType(0 To index)
- ReDim Preserve fData(0 To index)
- fType(index) = CInt(gCodes(i))
- fData(index) = gCodes(i + 1)
- Next
- typeArray = fType: dataArray = fData
- End Sub
|