'Here's the code, the layiso (isolate layer) command doesn't work.
Public Sub Main()
Dim CurSelSet As AcadSelectionSet, CurSet As AcadSelectionSet
Dim j As Integer, i As Integer, k As Integer
Dim SelCode(0 To 1) As Integer
Dim SelValue(0 To 1) As Variant
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'TESTING INSTRUCTIONS
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Set up a test Drawing with the following layers:
'0
'Bottom
'Bottom PROBE
'Bottom DEADSTOP
'Bottom PUSHPIN
'Test
'add one circle to each layer and turn on all layers so they are visible
'Set the Bottom layer as the current layer
'Select the circle on the Bottom layer
'Create a new VBA Project and add a module and paste this code
'Run the program
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'the PickFirstSelectionSet should have one item in it ("Bottom" layer circle)
Set CurSelSet = ThisDrawing.PickfirstSelectionSet
For i = 0 To CurSelSet.Count - 1
'temporary selection set
For j = 0 To ThisDrawing.SelectionSets.Count - 1
If ThisDrawing.SelectionSets.Item(j).Name = "SelSet" Then Exit For
Next j
If j = ThisDrawing.SelectionSets.Count Then
Set CurSet = ThisDrawing.SelectionSets.Add("SelSet")
Else
Set CurSet = ThisDrawing.SelectionSets.Item(j)
End If
CurSet.Clear
'go through all of the layers and turn on all layers that begin with Bottom
For j = 0 To ThisDrawing.Layers.Count - 1
'compare layer name against each item in the PickFirstSelectionSet
For k = 0 To CurSelSet.Count - 1
If (UCase(ThisDrawing.Layers(j).Name) = UCase(CurSelSet.Item(k).Layer) Or InStr(UCase(ThisDrawing.Layers(j).Name), UCase(CurSelSet.Item(k).Layer) & " ") = 1) Then
Debug.Print ThisDrawing.Layers(j).Name
SelCode(0) = 8
SelValue(0) = ThisDrawing.Layers(j).Name
SelCode(1) = 0
SelValue(1) = "CIRCLE"
CurSet.Select acSelectionSetAll, , , SelCode, SelValue
SelValue(1) = "ARC"
CurSet.Select acSelectionSetAll, , , SelCode, SelValue
SelValue(1) = "LINE"
CurSet.Select acSelectionSetAll, , , SelCode, SelValue
SelValue(1) = "LWPOLYLINE"
CurSet.Select acSelectionSetAll, , , SelCode, SelValue
End If
Next k
Next j
Next i
If CurSelSet.Count - 1 >= 0 Then
'isolate Bottom, Bottom PROBE, Bottom DEADSTOP, Bottom PUSHPIN layers only
ThisDrawing.SendCommand "layiso" & vbCr
CurSet.Clear
CurSet.Delete
Set CurSet = Nothing
End If
End
End Sub