While (nentsel) is very useful in accessing subentities, it does have the drawback of requiring user input. For instances in which the point selecting the subentity is already defined, the (nentselp) function is provided.
Explanation: the (nentselp) function
Command: (nentselp [prompt] point )
((<Entity name: 60000093>) (10.50000 11.43533
(nentselp) returns the same lists as (nentsel). When a PLINE is selected, it returns a two-element list similar to the one shown above. When a subentity of a BLOCK is selected, (nentselp) returns the same seven- element list as that returned by (nentsel).
In this practice you will use (nentselp) to extract the vertex of a polyline. Estimated time for completion: 5 minutes.
1. Define a point using (setq PT1 (getpoint “\nPick: “)).
2. Start the PLINE command, pick a few points, then enter !PT1 for one
of the points. End the PLINE command.
3. Extract the vertex at PT1 by typing in: (setq V1 (nentselp PT1)).