下表显示了 AutoCAD 能够识别的通配符以及每个通配符在上下文字符串中的含义:
使用单引号 (`) 表示下一个字符不是通配符,而是普通字符。例如,要指定仅将命名为“*U2”的匿名块包含在选择集中,请使用以下过滤器参数:
FilterType(0) = 2
FilterData(0) = "`*U2"
以下代码将选择条件定义为选择所有文字字符串中出现“The”的多行文字。本例还说明了 SelectByPolygon 选择方法的用法:
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