Use Filter Lists to Define Selection Set Rules

AutoCAD ActiveX

 
Use Filter Lists to Define Selection Set Rules
 
 
 

Filter lists are composed of pairs of arguments. The first argument identifies the type of filter (for example, an object), and the second argument specifies the value you are filtering on (for example, circles). The filter type is a DXF group code that specifies which filter to use. A few of the most common filter types are listed here.

DXF codes for common filters

DXF code

Filter type

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.

Zero indicates BYBLOCK. 256 indicates BYLAYER. A negative value indicates that the layer is turned off.

67

Model/paper space indicator (Integer)

Use 0 or omitted = model space, 1 = paper space.

For a complete list of DXF group codes, see Group Code Value Types in the DXF Reference.

The filter arguments are declared as arrays. The filter type is declared as an integer and the filter value as a variant. Each filter type must be paired with a filter value. For example:

FilterType(0) = 0            'Indicates filter refers to an object type
FilterData(0) = "Circle"     'Indicates the object type is "Circle"

Specify a single selection criterion for a selection set

The following code prompts users to select objects to be included in a selection set, but only adds the selected object if it is a circle:

Sub Ch4_FilterMtext()
   Dim sstext As AcadSelectionSet
   Dim FilterType(0) As Integer
   Dim FilterData(0) As Variant
   Set sstext = ThisDrawing.SelectionSets.Add("SS2")
   FilterType(0) = 0
   FilterData(0) = "Circle"
   sstext.SelectOnScreen FilterType, FilterData
End Sub