Accessing Subentities (Alternate) with autolisp in AutoCAD

An alternative method of accessing subentities is through the (nentsel) function, “nested entity selection.” (nentsel) is similar to (entsel), except that when a complex entity is selected information on a subentity is returned.

Explanation: the (netsel) function

Polylines

Command: (nentsel [prompt])
Select object: Pick on a pline
((<Entity name: 60000088>) (5.4532 7.20987 0.0))

The Entity name is that of the nearest vertex to the selection point.

Blocks

(nentsel) also lets us directly extract information about the entities that make up a block without accessing the block definition table.

Command: (nentsel)
Select object: Pick an entity in a block insertion (<Entity name: 400000be> (3.0 5.0 0.0) ((1.0 0.0 0.0)
(0.0 1.0 0.0) (0.0 0.0 1.0) (4.0 3.0 0.0)) (<Entity name:600000ea>))

  • The first two elements of the list are the name of the subentity and the pick point.
  • The third element is a list of points designating the model-to-world transformation matrix, useful in determining the orientation of the UCS both at the time of creation of the block and at its insertion. (For more information, see (nentsel) in the AutoLISP Function Catalog of the on-line help.)
  • The fourth element is the entity name of the block containing the selected entity or, if the entity picked is part of a nested block, it is the list of the names of all the nested blocks from innermost to outermost.
See also  AutoCAD and AutoLISP are Two Separate Programs

 

Notes

  • If the object is not a complex object, for example a line, then (nentsel) gives the same information as (entsel).
  • Remember, lightweight polylines are not considered complex objects.

Practice
Type in (nentsel) and select various parts of the polyline and block insert. Estimated time for completion: 5 minutes.

Back to top button