The FeatureLayer.SelectEntity method prompts the selection of one entity and returns its AutoCAD ObjectId. The entity is filtered by the specified feature layer and optional sublayer from the drawing.
Declaration
public ObjectId Esri.ArcGISForAutoCAD.FeatureLayer.SelectEntity(Document doc, string flName, string sublayerName = null, string promptMessage = null)
Parameters
| Type | Name | Description | Required |
|---|---|---|---|
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 |
| string | promptMessage | A message to prompt entity selection. | optional |
Returns
| Type | Description |
|---|---|
ObjectId | The AutoCAD ObjectId of the selected entity. |
Remarks on error conditions
This method may throw an exception or return null if a parameter is invalid.
Example
Select an entity that belongs to the Shelters feature layer in the current drawing and print its AutoCAD ObjectId.// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
// Select an entity and get its ObjectId
var shelterObjId = Esri.ArcGISForAutoCAD.FeatureLayer.SelectEntity(doc, "Shelters");
// Print the ObjectId
doc.Editor.WriteMessage("\nObjectId: " + shelterObjId.ToString());
/* Example output
ObjectId: (2195025992320)
*/
See also
FeatueLayer.SelectSpecial—A .NET method that returns an AutoCAD selection set from a specified feature layer based on a special criteria.
FeatureLayer.Select—A .NET method that returns a selection set filtered by the specified feature layer and optional sublayer from the drawing, and optionally, a specified selection set and attribute query.