The FeatureLabel.Place method creates a new text entity from the content of an existing field of a web or document feature layer. You can link feature attribute field values to most types of feature attribute fields. You cannot link reporting fields to text or block attribute values.
Declaration
public ObjectId Esri.ArcGISForAutoCAD.FeatureLabel.Place(Document doc, string flName, string fieldName, ObjectId featureObjId, Point3d placePoint, double textSize = 0)
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 | fieldName | The feature attribute field name source for the label. | required |
ObjectId | featureObjId | The AutoCAD ObjectId of the feature to link to the specified text. | required |
Point3d | placePoint | A 3D point where the new text label will be placed. | required |
double | textSize | The text height of the new text label to be placed. | optional |
Returns
| Type | Description |
|---|---|
ObjectId | The AutoCAD ObjectId of the created text entity. |
Remarks on error conditions
This method may throw an exception or return null if a parameter is invalid.
Example
Place a text label for the Owner attribute value of a selected Parcels feature, and print the AutoCAD ObjectId of the new text entity.// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
var flName = "Parcels";
var featureObjId = Esri.ArcGISForAutoCAD.FeatureLayer.SelectEntity(doc, flName);
var fieldName = "Owner";
var placePoint = doc.Editor.GetPoint("Place label: ").Value;
// Place label
var labelObjId = Esri.ArcGISForAutoCAD.FeatureLabel.Place(doc, flName, fieldName, featureObjId, placePoint);
// Print the label's ObjectId
doc.Editor.WriteMessage("\nObjectId: " + labelObjId.ToString());
/* Example output
ObjectId: (2100004115968)
*/
See also
esri_label_place—An AutoLISP function that places a feature attribute label.
FeatureLayer.SelectEntity —A .NET method that prompts the selection of one entity and returns its AutoCAD ObjectId.