posting here to a wider audience, looking for a guru who understands entities in autolisp to answer in depth some questions for understanding.
At a quick glance-over, it looks like the main issue is about (entlast), which does not get you the last object in any selection you may have made, but the last object drawn, with no relation to anything else such as a saved selection set. When the last object drawn is visible in the current space, it's equivalent to Last as a selection option in any editing command, but whether that's the case or not, (entlast) gets you the last object drawn, regardless of what space it's in.
Does that answer your question?
You might be interested in the attached BlockReplace.lsp, which contains two commands. BRA [= Block Replace--All] will ask you for a Block name [in your example, "BID_ONLY"], and for a Block to replace with that [in your example, "IFC stamp"], which you can choose to designate by either typing in its name or selecting an insertion of it. It will then replace all instances of the latter Block name with the former, retaining whatever Layer they're on and their scale factors and rotation, rather than putting all replacements on the current Layer with default scales and rotation, and in all spaces rather than only in the current space. See additional comments in the code.
It may need to be adjusted to account for Attributes, if they're not the same in the new Block as the old, because what it does is simply replace the Block name in the entity data for each insertion. So it may not be entirely right for your situation, but I find it a handy thing to have around.
Also, if the location of the new Block is in the Support File Search Path list, it will find it with just the Block name, but if not, you'll need to spell out the path along with the new Block name.
[It also contains a BRS command, for Block Replace--Selected, which replaces only selected Block insertions with the new Block name.]
Thanks Kent, yeah that will be useful, and you were right in your explination. Entlast makes alot more sense when looked at under those parameters, and makes sense of the problem we were having with the routine.
Very often we need to change the stamps on drawings, and I have yet to be able to find a routine for batch-stamp-replacing, where we could have one stamp in any amount of drawings replaced with another stamp, for all of those drawings, using the same layer and rotation and fortunately, the attribute in each of these stamps is standard and the same for most of the blocks we use, so it could save the attribute value and place in the same attribute spot in the new blocks.
Maybe i'll take a look at lee-mac's global attribute editor, and one of these block replacement tools and somehow combine them into a global block replacer.
I'm quite surprised Lee hasn't made one already though.
Perhaps I'll send him an email and ask if he has, and it isn't on his website for some reason...
You could get a little clever with this - create an XREF of a drawing with the inserted stamp block. Add the XREF to the required drawings. Need to change the stamp block? Change the one XREF. Kinda messes with attribute extraction though, if you need that sort of thing on a per-drawing basis.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.