Symbol names and strings in filter lists can include wild-card patterns.
The following table identifies the wild-card characters recognized by AutoCAD, and what each means in the context of a string:
Use a single quote (`) to indicate that a character is not a wildcard, but is to be taken literally. For example, to specify that only an anonymous block named “*U2” be included in the selection set, use the following filter arguments:
FilterType(0) = 2
FilterData(0) = "`*U2"
Select Mtext where a specific word appears in the text
The following code defines the selection criteria as any Mtext in which “The” appears in the text string. This example also demonstrates use of the SelectByPolygon selection method:
Sub Ch4_FilterPolygonWildcard()
Dim sstext As AcadSelectionSet
Dim FilterType(1) As Integer
Dim FilterData(1) As Variant
Dim pointsArray(0 To 11) As Double
Dim mode As Integer
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
Set sstext = ThisDrawing.SelectionSets.Add("SS10")
FilterType(0) = 0
FilterData(0) = "MTEXT"
FilterType(1) = 1
FilterData(1) = "*The*"
sstext.SelectByPolygon mode, pointsArray, FilterType, FilterData
End Sub