关于在选择集筛选条件中使用通配符模式 (VBA/ActiveX)
筛选器列表中的符号名称和字符串可以包含通配符模式。 下表标识了 AutoCAD 可识别的通配符,以及每个通配符在字符串上下文中的含义:
使用单引号 (') 表示字符不是通配符,而是按字面意思理解。例如,若要指定在选择集中仅包含名为“*U2”的匿名块,请使用以下筛选器参数: FilterType(0) = 2 FilterData(0) = "`*U2" 选择文本中出现特定单词的多行文本下面的代码将选择条件定义为文本字符串中出现“The”的任何条件。此示例还演示了选择方法的用法:MtextSelectByPolygon 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 |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 11:49
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.