I am looking for a routine that would add the next items created to a selection set.
Example:
Clear Selection Set
Set next items created to add to selection set
Array an object 10 times
All items that were arrayed were added to the current selection set
End adding items to selection set.
Now I should be able to:
Erase
P
and it would erase all the items I just added.
Thanks in advance for any help or pointers
I do not have a single routine that does what you want, but do use several that accomplish the task. The first one is a command line function that saves the entity name of the last undeleted entity at the time it is run to a global variable. The second one is a function that reads the value of that global variable and then proceeds to build a selection set starting with the first entity created after the entity represented by the saved entity name, using a while loop and the entnext command. The function returns the selection set, so it can be run in response to an AutoCAD command looking for a selection set. I also have a command line function that runs the second function and then takes the returned selection set and feeds it to the SELECT command, so that the returned selection set becomes the "Previous" set for a subsequent AutoCAD command.
A down-and-dirty set of functions/routines should be fairly easy to create.
I found an old version of my routine and have attached it. I subsequently complicated it a bit, adding the ability to run EMARK multiple times, saving a list of the "last" entities, and then be able to undo one or more of the EMARK runs (and, if undone, to redo them), but quite frankly, I rarely ever use that and while I am fairly certain there was a specific task that prompted me to write the code for it, I no longer recall what it was.
The C:EMARK command function uses (entlast) to get the current last main object. In case the last main object was a complex object (such as an old style polyline - the only type there was when I first wrote this, followed by vertices, or an attributed block, followed by attributes), I used a while loop to make certain I had the absolute last object. The last entity name is stored in a global variable called ELAST.
The ETRAP function checks the value of ELAST, and if an entity name is found, makes a selection set of subsequently created entities if there are any.
The C:ETRAP command function runs the ETRAP function; if there were any subsequently created entities, it uses the SELECT command to make the returned selection set the previous selection set for any future AutoCAD commands.