Home AutoCad VB Selection Set Filter
20 | 05 | 2012
This site has been updated and renewed. You have followed an old link.

Click here to go to the new site

http://www.visiblevisual.com/jupgrade

Selection Set Filter PDF Print E-mail
User Rating: / 1
PoorBest 
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
 
   MsgBox "The selectionset contains:" & ss.Count & " entities."
 
End Sub

 
'Code below is used to create a selectionset
 
Public Function CreateSelectionSet(SSset As StringAs 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 FunctionEnd 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.
2 Object Name (String) The table (given) name of a named object.
8 Layer Name (String) Such as “Layer 0.”
60 Object Visibility (Integer) Use 0 = visible, 1 = invisible.
62 Color Number (Integer) Numeric index values ranging from 0 to 256.
67 Model/paper space indicator (Integer) Use 0 or omitted = model space, 1 = paper space.

 

 

Comments   

 
0 #1 Guest 2011-06-21 21:06
THANKS :-)
Quote
 

Add comment


Security code
Refresh

This site has been updated and renewed. You have followed an old link.

Click here to go to the new site

http://www.visiblevisual.com/jupgrade