Skip To Content

esri_attributes_get (AutoLISP)

The esri_attributes_get function gets an associated list of the field names and their attribute values.

The following are usage notes:

  • If only the entity name is provided, all attribute fields and their values stored on the entity are returned.
  • If the "FLNAME" value is provided, only attributes belonging to that feature layer are included; however, the default values are also included.
  • If the "FIELDNAME" value is provided, only that specific field name and its value are returned.
  • If both the "FLNAME" and FIELDNAME values are provided, only the stored value of the field or its default is returned in a list as a dotted pair, and then only if it belongs to the feature layer.

Syntax

(esri_attributes_get ename [attribute_settings])

Arguments

  • ename |AutoCAD entity name| required | The AutoCAD entity name of the feature.
  • attribute_settings | associated list | optional | A list of optional settings as dotted pairs to limit fields and return appropriate default values as follows:

    Associated labelValue typeValue descriptionRequired or optional
    "FLNAME"

    string

    The feature layer name. It is assumed that the entity is a member of this feature layer and will only include field values for the specified feature layer and it will return its default values.

    Optional

    "FIELDNAME"

    string

    A single field name to limit the returned value to this one field. If the FLNAME value is also provided, the FIELDNAME value must exist in that feature class definition.

    Optional

Example usage 1

Attempt to get all the Centerlines feature layer attributes for the selected entity.

(esri_attributes_get (car (entsel)) (list (cons "FLNAME" "Centerlines")))

Result example usage 1

Return all the Centerlines feature layer attributes for the selected entity as an associated list:

(("EntityHandle" . "252") ("EntityType" . "LWPOLYLINE") ("StreetName" . "S Roosevelt Blvd") ("Pavement" . 6) ("Rating" . 0.6259))

Example usage 2

Attempt to get the StreetName field value from the Centerlines feature layer for the selected entity.

(esri_attributes_get (car (entsel)) (list (cons "FLNAME" "Centerlines") (cons "FIELDNAME" "StreetName")))

Result example usage 2

Return the StreetName field value for the selected entity as an associated list:

(("StreetName" . "White Street"))

Return values

The following are the possible return values:

  • If successful, the function returns an associated list of field names and values as dotted pairs.
  • If failed, it 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" . "No attributes found on entity."))

    The entity does not have any of the specified field values.

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

    The specified feature layer does not exist in the file.

  • (nil ("Error" . "Invalid associated list"))

    The attribute_settings parameter was improperly structured or contained invalid values.

  • (nil ("Error" . "No fields found."))

    An incorrect field name was provided.

See also

esri_featurelayer_getattributes—A function that returns a list of associated lists of all the attributes of all the features of the specified feature layer in the drawing.