AutoCAD Architecture Customization
Welcome to Autodesk’s AutoCAD Architecture Customization Forums. Share your knowledge, ask questions, and explore popular AutoCAD Architecture Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp Routine to set next items created to selection set.

3 REPLIES 3
Reply
Message 1 of 4
thebabins
622 Views, 3 Replies

Lisp Routine to set next items created to selection set.

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

3 REPLIES 3
Message 2 of 4
David_W_Koch
in reply to: thebabins

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.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 3 of 4
thebabins
in reply to: thebabins

That sounds like its something that would work!

Message 4 of 4
David_W_Koch
in reply to: thebabins

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.

 

 


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost