Skip To Content

esri_label_set (AutoLISP)

This function adds or modifies the relationship between an attribute field of a feature and an AutoCAD TEXT, MTEXT, DIMENSION, or ATTDEF entity.

  • If the label entity's text value is modified, the linked feature's attribute value will be updated automatically.
  • If the attribute value of the linked feature is modified, the value in the linked text entity will be updated automatically.
  • You can link feature attribute field values to most kinds of feature attribute fields.
  • You cannot link reporting fields to text or block attribute values.
  • Linked DIMENSION entities will be read-only. The linked field value is derived from the DIMENSION text.

Syntax

(esri_label_set flname field feature_ename text_ename)

Arguments

  • flname | string | required | An existing feature layer name in the drawing
  • field | string | required | An existing feature layer attribute field name
  • feature_ename | string | required | The AutoCAD entity name of the feature to link to the specified text
  • text_ename | string | required | The AutoCAD entity name of the text entity to link as a field attribute value

Example usage

Prompts to graphically select a feature of the Parcels feature layer and then a text entity to set the Owner field's value.

(progn
(setq feature_ent (car (entsel)))
(setq text_ent (car (entsel)))
(esri_label_set "Parcels" "Owner" feature_ent txt_ent)
)

Result example usage

The selected text entity's value is linked as the value of the selected feature's Owner field and returns a list of true:

(T)

Return values

The following are the possible return values:

  • If successful, the function returns a list of true: (T)
  • If failed, it returns a list with the first value of nil and then an associated list containing the key value "Error" and an associated error message as a string: (nil ("Error" . "<message>")).

Failed return values

Failed return values can occur for any of the following reasons:

  • (nil ("Error" . "Missing required argument."))

    One of the required arguments was not supplied.

  • (nil ("Error" . "No valid fields specified."))

    The specified field is not a valid field of the specified feature layer.

  • (nil ("Error" . "Feature layer not found."))

    The specified feature layer value is not a valid feature layer in the drawing.