Skip To Content

FeatureLabel.Get (.NET)

The FeatureLabel.Get method returns the AutoCAD ObjectId value of the text entity label linked to a specified feature attribute field of a feature.

Declaration

public ObjectId Esri.ArcGISForAutoCAD.FeatureLabel.Get(Document doc, string fieldName, ObjectId objId)

Parameters

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

required

string

fieldName

The feature layer attribute field name source for the label.

required

ObjectId

objId

The AutoCAD ObjectId value of the linked feature.

required

Returns

TypeDescription

ObjectId

The AutoCAD ObjectId value of the of the linked text entity label.

Remarks on error conditions

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

Example

Print the AutoCAD ObjectId value of the text entity that is linked to the Owner field of the selected feature.

// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
var objId = Esri.ArcGISForAutoCAD.FeatureLayer.SelectEntity(doc, "Parcels");
var fieldName = "Owner";

// Get the label ObjectId
var labelObjId = Esri.ArcGISForAutoCAD.FeatureLabel.Get(doc, fieldName, objId);

// Print the label ObjectId
doc.Editor.WriteMessage("ObjectId: " + labelObjId);

/* Example output 
ObjectId: (2474960765072)
*/

See also

FeatureLayer.SelectEntity (.NET)—This method prompts the selection of one entity and returns its AutoCAD ObjectId value.

esri_label_get—An AutoLISP function that gets the label information from a feature.