| Selection Set Filter |
|
|
|
| Tutorials | |||
|
The code below is a sample of how to filter a selection before its added to a selection set. This example uses two filter. One to filter that the objetc is a Line and the other criteria is that it has to reside on the layer called "0". [code] Sub FilterSelectionSet()
'****************************************
'*** Code from VisibleVisual.com ********
'****************************************
Dim ss As AcadSelectionSet
Dim FilterType(0) As Integer
Dim FilterData(0) As Variant
Set ss = CreateSelectionSet("SStemp")
FilterType(0) = 0 'Indicates filter refers to an object type
FilterData(0) = "Circle" 'Indicates the object type is "Line"
FilterType(1) = 8 '8 Indicates a filter that refers to a layer
FilterData(1) = "0" 'The layer resides on layer "0"
ss.Select acSelectionSetAll, , , FilterType, FilterData
End Sub
'Code below is used to create a selectionset
Public Function CreateSelectionSet(SSset As String) As AcadSelectionSet
'****************************************
'*** Code from VisibleVisual.com ********
'****************************************
'This Function Checks if a selection set exists
'If so it will be cleared
'If not then it will be created
On Error Resume Next
Set CreateSelectionSet = ThisDrawing.SelectionSets(SSset)
If Err Then
Set CreateSelectionSet = ThisDrawing.SelectionSets.Add(SSset)
Else
Exit Function: End If
CreateSelectionSet.Clear
Set CreateSelectionSet = ThisDrawing.SelectionSets.Item(SSset)
End Function
[/code] Other Filtertypes are displayed below:0 Object Type (String) Such as “Line,” “Circle,” “Arc,” and so forth.
|



Comments
RSS feed for comments to this post