Skip To Content

FeatureLayer.GetQuery (.NET)

The FeatureLayer.GetQuery method returns an AutoCAD SelectionFilter with the query filter properties for the specified web or document feature layer.

Declaration

public SelectionFilter Esri.ArcGISForAutoCAD.FeatureLayer.GetQuery(Document doc, string flName, string sublayerName = null)

Parameters

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

required

string

flName

An existing feature layer name in the drawing.

required

string

sublayerName

An existing feature layer sublayer name in the drawing.

optional

Returns

TypeDescription

SelectionFilter

An AutoCAD selection filter representing the query used to define the feature layer, containing DXF codes and values that combine to create a filtering query for the feature layer.

Remarks on error conditions

This method can throw an exception or may return null if a parameter is invalid.

Example 1

Print the filter query properties for the Buildings feature layer, which include the DXF codes for layer 8 and color 62.

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

// Get the query 
var query = Esri.ArcGISForAutoCAD.FeatureLayer.GetQuery(doc, "Buildings");

// Print the query
foreach (var typedValue in query.GetFilter())
  doc.Editor.WriteMessage("\n" + typedValue.ToString());

/* Example output
(8,Buildings,Homes)
(62,9)
*/

Example 2

Print the filter query properties for the Open sublayer of the Shelters feature layer, which includes the DXF code for layer 8.

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

// Get the query 
var query = Esri.ArcGISForAutoCAD.FeatureLayer.GetQuery(doc, "Shelters", "Open");

// Print the query
doc.Editor.WriteMessage(query.GetFilter().First().ToString());

/* Example output
(8,ESRI_Shelters_Open)
*/

See also

esri_featurelayer_getquery - An AutoLISP function that gets feature layer query information.