When we execute the (entget) function with the name of a polyline as the argument, we get a list similar to the following:

((-1 . <entity name: 60000018>) (0 . “Polyline”) (8.”0″)(66.1)(10.0.00.00.0)(70.0)(40.0.0) (41.0.0)(210.0.00.01.0)(71.0)(72.0)(73.0) (74.0)(75.0))

Notice that this list contains no information on the vertices of the polyline, while AutoCAD’s LIST command returns information on each vertex of a polyline.

A similar situation applies to the attributes associated with a block insertion. Block inserts and polylines are considered complex entities because they consist of subentities in addition to the main entity itself. There are two functions designed to access subentities, (entnext) and (nentsel).

Accessing Entity Names and Lists Quickly

For our discussion of subentities we will use two functions that were created in an earlier module and stored in the GET.LSP file. This will save us a lot of typing, so load GET.LSP if you created it or type in the following code:

;;; GETNAME – returns the ENTITY NAME (ename)
;;; of the selected entity
(defun GETNAME ()
(car (entsel))
)
;;; GETLIST – returns the ENTITY LIST
;;; of the selected entity
(defun GETLIST ()
(entget (car (entsel)))
)

A complete solution to this exercise is on your class disk as GET-A.LSP.