選択フィルタは、TypedValues の形式の引数のペアで構成されます。TypedValue の最初の引数はフィルタの種類を示します(たとえば、オブジェクト)。2 つめの引数は、フィルタする値を指定します(たとえば、円)。フィルタ タイプは、制限したいフィルタの種類を示す、DXF グループ コードです。一般的なフィルタ タイプのいくつかを、次にまとめます。
| 
 一般的なフィルタの DXF コード  | 
|
|---|---|
| 
 DXF コード  | 
 フィルタ タイプ  | 
| 
 0 (または DxfCode.Start)  | 
 オブジェクト タイプ(文字列) "Line"、"Circle"、"Arc" など  | 
| 
 2 (または DxfCode.BlockName)  | 
 ブロック名(文字列) 挿入参照のブロック名。  | 
| 
 8 (または DxfCode.LayerName)  | 
 画層名(文字列) "画層 0" など  | 
| 
 60 (DxfCode.Visibility)  | 
 オブジェクトの表示/非表示(整数) 0 =表示、1 =非表示  | 
| 
 62 (または DxfCode.Color)  | 
 色番号(整数) 0~256 のインデックス値 0 は BYBLOCK を表す。256 は BYLAYER を表す。画層テーブルの色番号で、負の値は、その画層が非表示になっていることを示します。  | 
| 
 67  | 
 図形がモデル/ペーパー空間のどちらにあるか(整数) 0 または省略時=モデル空間、1=ペーパー空間  | 
次のコードは、選択セットに含めるオブジェクトを選択するためのプロンプトをユーザに表示し、円を除くすべてのオブジェクトを除外します。
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
 
<CommandMethod("FilterSelectionSet")> _
Public Sub FilterSelectionSet()
    '' Get the current document editor
    Dim acDocEd As Editor = Application.DocumentManager.MdiActiveDocument.Editor
    '' Create a TypedValue array to define the filter criteria
    Dim acTypValAr(0) As TypedValue
    acTypValAr.SetValue(New TypedValue(DxfCode.Start, "CIRCLE"), 0)
    '' Assign the filter criteria to a SelectionFilter object
    Dim acSelFtr As SelectionFilter = New SelectionFilter(acTypValAr)
    '' Request for objects to be selected in the drawing area
    Dim acSSPrompt As PromptSelectionResult
    acSSPrompt = acDocEd.GetSelection(acSelFtr)
    '' If the prompt status is OK, objects were selected
    If acSSPrompt.Status = PromptStatus.OK Then
        Dim acSSet As SelectionSet = acSSPrompt.Value
        Application.ShowAlertDialog("Number of objects selected: " & _
                                    acSSet.Count.ToString())
    Else
        Application.ShowAlertDialog("Number of objects selected: 0")
    End If
End Sub
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
 
[CommandMethod("FilterSelectionSet")]
public static void FilterSelectionSet()
{
    // Get the current document editor
    Editor acDocEd = Application.DocumentManager.MdiActiveDocument.Editor;
    // Create a TypedValue array to define the filter criteria
    TypedValue[] acTypValAr = new TypedValue[1];
    acTypValAr.SetValue(new TypedValue((int)DxfCode.Start, "CIRCLE"), 0);
    // Assign the filter criteria to a SelectionFilter object
    SelectionFilter acSelFtr = new SelectionFilter(acTypValAr);
    // Request for objects to be selected in the drawing area
    PromptSelectionResult acSSPrompt;
    acSSPrompt = acDocEd.GetSelection(acSelFtr);
    // If the prompt status is OK, objects were selected
    if (acSSPrompt.Status == PromptStatus.OK)
    {
        SelectionSet acSSet = acSSPrompt.Value;
        Application.ShowAlertDialog("Number of objects selected: " +
                                    acSSet.Count.ToString());
    }
    else
    {
        Application.ShowAlertDialog("Number of objects selected: 0");
    }
}
Sub FilterSelectionSet()
    ' Create a new selection set
    Dim sset As AcadSelectionSet
    Set sset = ThisDrawing.SelectionSets.Add("SS1")
 
    ' Define the filter list, only Circle objects
    ' will be selectable
    Dim FilterType(0) As Integer
    Dim FilterData(0) As Variant
    FilterType(0) = 0
    FilterData(0) = "Circle"
 
    ' Prompt the user to select objects
    ' and add them to the selection set
    sset.SelectOnScreen FilterType, FilterData
 
    MsgBox "Number of objects selected: " & sset.Count
 
    ' Remove the selection set at the end
    sset.Delete
End Sub