Skip To Content

DocFeatureLayer.SetQuery (.NET)

The DocFeatureLayer.SetQuery method modifies the QUERYFILTER value of an existing document feature layer. You cannot modify the query definition of feature layers with subtypes. Feature layers with subtypes are always defined with a single AutoCAD layer definition.

Declaration

public bool Esri.ArcGISForAutoCAD.DocFeatureLayer.SetQuery(Document doc, string flName, SelectionFilter queryFilter)

Parameters

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

required

string

flName

An existing document feature layer name in the drawing.

required

SelectionFilter

queryFilter

The AutoCAD SelectionFilter of DXF codes and property values that define members of the feature layer. Operational conditions are set using the "-4" DXF code.

required

Returns

TypeDescription

bool

true if the query was set successfully.

Remarks on error conditions

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

Example

Print the success of setting the query of the Simple_Lines document feature layer to all arcs or lines.

// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
var flName = "Simple_Lines";
var queryFilter = new SelectionFilter(new TypedValue[] 
{
  new TypedValue(-4, "<OR"), 
  new TypedValue(70, "ARC"),
  new TypedValue(70, "LINE"),
  new TypedValue(-4, "OR>") 
});

// Set the query
var success = Esri.ArcGISForAutoCAD.DocFeatureLayer.SetQuery(doc, flName, queryFilter);

// Print the success
doc.Editor.WriteMessage(success.ToString());

/* Example output
True
*/

See also

esri_docfeaturelayer_setquery—An AutoLISP function that modifies the QUERYFILTER value of an existing document feature layer.