Skip To Content

esri_attributes_get (AutoLISP)

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

Usage:

  • 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 | List of optional settings as dotted pairs to limit fields and return appropriate default values.

    Associated labelValue typeValue descriptionRequired/Optional
    "FLNAME"

    string

    Feature layer name. Assumes 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

    Single field name to limit returned value to this one field. If the FLNAME value is also supplied, 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

Returns 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 Steetname field value from any feature layer for the selected entity.

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

Result example usage 2

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

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

Return values

This function returns a value.

  • If successful 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."))

    Entity does not have any of the specified field values.

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

    The attribute_settings parameter was improperly structured or contained invalid values.

  • (nil ("Error" . "Optional field value not found on entity."))

    The entity does not have the specified field value.

See also

esri_featurelayer_getattributes | A function to return a list of associated lists of all the attributes of all the features of the specified feature layer in the drawing.