The esri_featurelayer_select function returns an AutoCAD selection set filtered by the specified feature layer and optional subtype from the drawing, and optionally the specified selection set. This function is similar to Objects option of the Select Features tool on the context menu of a web feature layer or document feature layer in the Contents pane.
Syntax
(esri_featurelayer_select flname subtype [select_settings])
Arguments
- flname | string | required | An existing web feature layer or document feature layer name in the drawing.
- subtype | string | required | The subtype name of the feature layer, or empty string "" for all subtypes or if there are no subtypes.
- select_settings | associated list | optional | A list of optional settings as dotted pairs to limit the selection set by attribute query and preselection.
Associated label Value type Value description Required or optional "SSET" AutoCAD selection set object
An AutoLISP selection set object. The AutoCAD AutoLISP function (ssget) can be used to prompt the user to select entities for this function. If no selection set is provided, all of the features of the feature layer of the specified subtype will be included in the returned selection set as will all AutoCAD selection sets. It is a best practice to release the resources used by all selection sets after using them. To do this, set the selection sets to nil after use.
Optional
"ATTRIBUTEQUERY" string
A where clause using a single field name to limit returned value to this one field. If the flname value is also supplied, the field name included in the where clause string must exist in that feature class definition.
Optional
Note:
Attempting to manage a large number of selection sets simultaneously is not recommended. An application cannot have more than 128 selection sets open at once. (The limit may be lower on your system.) When the limit is reached, AutoCAD will not create more selection sets. Keep a minimum number of sets open at a time, and set unneeded selection sets to nil as soon as possible. If the maximum number of selection sets is reached, you cannot create more.
Example usage 1
This example creates a selection set of all the entities that belong to the Shelters feature layer in the current drawing:(esri_featurelayer_select "Shelters" "")
Result example usage 1
A selection set of all the entities that belong to the Shelters feature layer is returned:
<Selection set: 2e>Example usage 2
This example creates a selection set of all the entities that belong to subtype 1 of the Shelters feature layer in the current drawing when the capacity field values are greater than 400:(esri_featurelayer_select "Shelters" "1"
(list (cons "ATTRIBUTEQUERY" "capacity > 400"))
)
Result example usage 2
A selection set of all the entities that belong to subtype 1 of the Shelters feature layer in the current drawing when the capacity field values are greater than 400 is returned:
<Selection set: 30>Return values
The following are the possible return values:
- If successful, returns an AutoCAD selection set object.
- If failed, returns a list with the first value of nil; then an associated list is returned containing the key value "Error" and an associated error message as a string: (nil ( "Error" . "<message>"))
Failed return values
A failed return value can occur for any of the following reasons:
- (nil ("Error" . "Missing required
argument."))
One or more required arguments was not supplied.
- (nil ("Error" . "Feature layer not found."))
The required feature layer value is not valid or is missing.
- (nil ("Error" . "Sublayer not found."))
The required subtype name is not valid or is missing.