Skip To Content

FeatureLayer.Select (.NET)

FeatureLayer.Select 方法将返回按来自工程图的指定要素图层和可选子图层过滤的 AutoCAD 选择集,以及可选的指定选择集和属性查询。 此方法类似于选择要素工具的对象选项,该工具位于内容窗格的 web 要素图层或文档要素图层的快捷菜单上。

注:

建议不要尝试同时管理大量选择集。 应用程序不能同时打开超过 128 个选择集。 (您的系统上的限值可能更低。)达到限值后,AutoCAD 将不会创建更多选择集。 每次保持打开最小数量的集合,并尽快将其从内存中释放出来。 如果达到选择集的最大数量,则将无法创建更多选择集。

声明

public SelectionSet Esri.ArcGISForAutoCAD.FeatureLayer.Select(Document doc, string flName, string sublayerName = null , SelectionSet selectionSet = null, string attributeQuery = null)

参数

类型名称描述必填

文档

doc

要进行操作的 AutoCAD 文档。

必填

string

flName

工程图中现有的要素图层名称。

必填

string

sublayerName

工程图中现有的要素图层子图层名称。

可选

SelectionSet

selectionSet

要过滤的 ArcGIS for AutoCAD 对象集合。

可选

string

attributeQuery

使用单个字段名称来限制返回值的 WHERE 子句。

可选

返回

类型描述

SelectionSet

AutoCAD 选择集对象。

错误条件备注

如果参数无效,则此方法可能会抛出异常或者返回 null

示例 1

打印当前工程图中属于 Shelters 要素图层的实体的数量。

// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;

// Create a selection set of all entities that belong to the feature layer
var sheltersSelection = Esri.ArcGISForAutoCAD.FeatureLayer.Select(doc, "Shelters");

// Print the count
doc.Editor.WriteMessage("\nNumber of entities selected: " + sheltersSelection.Count.ToString());

/* Example output
Number of entities selected: 36
*/

示例 2

打印当前工程图中属于 Shelters 要素图层 Open 子图层,且容量字段值大于 400 的实体的数量。

// Initialize 
var doc = Application.DocumentManager.MdiActiveDocument;

// Create a selection set of the entities that meet the selection criteria
var sheltersSelection = Esri.ArcGISForAutoCAD.FeatureLayer.Select(doc, "Shelters", "Open", null, "capacity > 400");

// Print the count
doc.Editor.WriteMessage("\nNumber of entities selected: " + sheltersSelection.Count.ToString());

/* Example output
Number of entities selected: 3
*/

另请参阅

FeatueLayer.SelectSpecial - 此 .NET 方法将基于特殊条件返回指定要素图层的 AutoCAD 选择集。

esri_featurelayer_select - 此 AutoLISP 函数将返回按来自工程图的指定要素图层和可选子图层过滤的 AutoCAD 选择集,以及可选指定选择集。