外部应用程序可以向 AutoCAD 对象附加数据,例如文字字符串、数值、三维点、距离和图层名。这种数据称为外部数据或外部数据。用户可以过滤包含指定的应用程序外部数据的图元。
关于外部数据的详细信息,请参见过滤外部数据。
下例将通过过滤查找出包含通过“MY_APP”应用程序添加的外部数据的圆:
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