This is made from some pieces of code I use....no promises.
Public Function Get3dObjects()
'------------------------------------------------------------------------------
'Get3dObjects:
'------------------------------------------------------------------------------
Dim acSelSet As AcadSelectionSet
Dim iCode() As Integer
Dim vValue() As Variant
'''''''''''''''''''''''''''''''''''''''
'--------------------------------------------------------------------------
'Filter set
'--------------------------------------------------------------------------
ReDim iCode(4): ReDim vValue(4)
iCode(0) = -4: vValue(0) = "<OR"
iCode(1) = 0: vValue(1) = "3DFACE"
iCode(2) = 0: vValue(2) = "3DSOLID"
iCode(3) = 0: vValue(3) = "POLYLINE"
iCode(4) = -4: vValue(4) = "OR>"
Set acSelSet = GetMultiEntSS(iCode, vValue)
End Function
Public Function GetMultiEntSS(ByVal vFiltType As Variant, ByVal vFiltData As _
Variant) As AcadSelectionSet
'------------------------------------------------------------------------------
'GetMultiEntSS: Select from all entities and return selection set of all items
' of the type provided
'Arguments: vFiltType:
'Returns: AcadSelectionSet
'Example:
'ReDim iCode(3): ReDim vValue(3)
' iCode(0) = -4: vValue(0) = "<OR"
' iCode(1) = 2: vValue(1) = "SOMEBLOCKNAME"
' iCode(2) = 2: vValue(2) = "SOMEOTHERBLOCKNAME"
' iCode(3) = -4: vValue(3) = "OR>"
'
' Set acSS = GetMultiEntSS(intCode, vntValue)
'------------------------------------------------------------------------------
Dim acSelSet As AcadSelectionSet
Dim intMode As Integer
Dim vntFilterType As Variant
Dim vntFilterData As Variant
'''''''''''''''''''''''''''''''''''''''
intMode = 5 'acSelectionSetAll
Set acSelSet = ClearSS("MSSET")
vntFilterType = vFiltType
vntFilterData = vFiltData
acSelSet.Select intMode, , , vntFilterType, vntFilterData
Set GetMultiEntSS = acSelSet
Set acSelSet = Nothing
End Function
Public Function ClearSS(ByVal strName As String) As AcadSelectionSet
'------------------------------------------------------------------------------
'ClearSS: The input selection set name is deleted from the drawing so
' that the selection set name can be reused.
'Arguments: strName - name of selection set to create in the drawing
'Returns: Returns the selection set, cleared of all items
'------------------------------------------------------------------------------
On Error GoTo ErrHandler
Dim acSelSet As AcadSelectionSet
Dim acSelSets As AcadSelectionSets
'''''''''''''''''''''''''''''''''''''''
Set acSelSets = ThisDrawing.SelectionSets
For Each acSelSet In acSelSets
If acSelSet.name = strName Then
ThisDrawing.SelectionSets.Item(strName).Delete
Exit For
End If
Next
Set acSelSet = ThisDrawing.SelectionSets.Add(strName)
Set ClearSS = acSelSet
ExitHere:
Exit Function
ErrHandler:
Debug.Print vbObjectError + 514, "PP_ACAD Error", _
"Function 'ClearSS' Failed"
End Function
"Everybody is ignorant, only on different subjects." — Will Rogers