About Filtering for Extended Data (VBA/ActiveX)

External applications can attach data such as text strings, numeric values, 3D points, distances, and layer names to AutoCAD objects.

This data is referred to as extended data, or xdata. You can filter entities containing extended data for a specified application.

Select circles that contain xdata

The following example filters for circles containing xdata added by the “MY_APP” application:

Sub Ch4_FilterXdata()
  Dim sstext As AcadSelectionSet
  Dim mode As Integer
  Dim pointsArray(0 To 11) As Double
  mode = acSelectionSetWindowPolygon
  pointsArray(0) = -12#: pointsArray(1) = -7#: pointsArray(2) = 0
  pointsArray(3) = -12#: pointsArray(4) = 10#: pointsArray(5) = 0
  pointsArray(6) = 10#: pointsArray(7) = 10#: pointsArray(8) = 0
  pointsArray(9) = 10#: pointsArray(10) = -7#: pointsArray(11) = 0
  Dim FilterType(1) As Integer
  Dim FilterData(1) As Variant
  Set sstext = ThisDrawing.SelectionSets.Add("SS9")

  FilterType(0) = 0
  FilterData(0) = "Circle"
  FilterType(1) = 1001
  FilterData(1) = "MY_APP"

  sstext.SelectByPolygon mode, pointsArray, FilterType, FilterData
End Sub