Entity Names

Entities are necessary for manipulating data in drawing files.

All graphic items (lines, circles, etc...) are entities.

Useful Entity Functions

Code:

(entlast)

will return the last graphic entity in a drawing.

Code:

(handent "1C7")

will return the entity associated with the unique hexadecimal identifier called a handle.

Code:

(entsel)

will prompt the user to select an object and return a list with two items including the entityname the point selected.

So...

Code:

(car (entsel))

will return a selected objects entity name (car returns the first item in a list)

So to get and store an entityname you use the setq expression.

Code:

(setq entSelection (car (entsel "\nSelect One Item: ")))

the entsel expression allows for a prompt ("\n" is a carriage return)

The default prompt is "Select objects:"

There is also

Code:

(setq entSelectionNested (car (nentsel "\nSelect nested item: ")))

Which allows the user to select items nested inside other items (like blocks)

Try it and comment to the discussion thread.