HOW DO YOU SELECT THE LAST ITEMS COPIED ??
HOW DO YOU SELECT THE LAST ITEMS COPIED ??
(OP)
Trying to in a Button macro select objects then copy then lake the copies and place them on the current layer but when i call the l for the last objects then it only selects the last 1 so if there were 2 or more copied then only one gets selected does anyone know what you do to select the last created set of items or am i going about this the wrong way im not looking for all in a lsp im just trying to do something short and simple
if everyone helps everybody the world will be a better place





RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
1)Get the selection set
2)Copy "previous" from 0,0 to 0,0 (now the copied objects are right "on top of" the selection set)
3)Move "previous" (you will actually be moving the original selection set "out from under" the copies)
4)Change the layer of the "previous" selection set to the current layer.
To fancy this up, you will want to "erase" "previous" if the function is cancelled by the user.
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
command
select
select some objects
then start the copy command
when it asks you to select objects use p for previous
then after you place the copy somewhere the do a select l for last it only selects 1 object wuts up with that this is in acad 2002
if everyone helps everybody the world will be a better place
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
Try this routine, it uses idea from engrmech_vis about copying in place, then your selection set is becomes your new items.
Regards,
Carl
(defun c:ccl ()
(princ "Copy to current layer")
(setq ss1 (ssget))
(setvar "cmdecho" 0)
(command "._copy" ss1 "" "0,0" "0,0")
(setq pt1 (getpoint "\from point: "))
(command "._change" ss1 "" "_p" "_la" (getvar "clayer") "")
(command ".move" ss1 "" pt1)
(princ "to point: ")
(command pause)
(setvar "cmdecho" 1)
(princ)
);defun
(princ "\nStart with CCL")
(princ)
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
(defun rcopyerror(s)
(command "erase" "p" "")
(princ)
(princ (strcat "\nError: " s))
(setq *error* olderr)
);end rcopyerror
(defun C:RCOPY()
(setvar "CMDECHO" 0)
(princ "Rotate Retaining Old Objects")
(ssget)
(command "copy" "p" "" "0,0" "0,0")
(setq olderr *error*
*error* rcopyerror);redefine error handler
(setvar "CMDECHO" 1)
(command "rotate" "p" "" pause "r" "@" pause pause)
(setvar "CMDECHO" 0)
(command "redraw")
(menucmd "s=chla")
(prompt "Select new Layer for RCOPIED Objects, or RETURN for No Change")
(command "change" "p" "" "properties" "la" pause "")
(menucmd "s=rotate")
(princ)
(setq *error* olderr);reset the error handler
);end rcopy
This has the error handling in place to delete the copy if you cancel, and you should be able to adapt it by combining with Carl's code. The menucmd "s=chla" calls up a menu (sidebar) that lets the user pick from the menu to decide which layer to put things on, you could adapt it by just getting the current layer.
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
this is the button macro that im using give it a shot the key is the copy isnt in the same spot as the original
if everyone helps everybody the world will be a better place
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
You just aren't hearing.
I confess that I don't know beans about button macros, if I had to guess, you won't get what you want without writing a lisp routine. I learned Acad long ago, and have nver done anything with button macros. The last I used Acad was r14, (Inventor user now) and I used pull-down and side (screen) menus, feeling that pallets and buttons were just screen (area) wasting, marketing stuff.
Lisp is not pretty to look at, but after using it some you can make sense of it. The routines (lisp) that Carl and I have provided get you close to what you want. I'll lead you thru what I'm talking about: I assume classic Acad selection setting (verb/noun) which is to say; I first specify that I want to do, Copy/Erase/Move/Whatever, then select the object(s) that I want to do that to, hit ENTER, then specify, From "Here" to "There". If you don't understand what I mean, you need to quit posting to this forum and go learn Acad (just being honest, trying to help).
Type what I put in quotes to the command line; This is a good way to concept and start (even debug) anything that you plan to do with lisp.
1)Get the command line up (does Acad still have that?).
2)Draw 3 lines.
3)Type: "copy" ENTER
4)Select the 3 lines in whatever way pleases you, "Enter" to complete the selection set.
5)Acad is asking: From: type "0,0" hit "Enter"
6)Acad is asking: To: type : "0,0" hit "Enter"
7)Type: "Move" ENTER
8)Type: "p" (meaning PREVIOUS) hit "Enter"
9)Acad is asking: From: Pick a Point
10)Acad is asking: To: Pick a (different) point
11)You have now moved the original 3 lines "out from under" the copies, and completed the task that you said you wanted, except for the layer change, which can be done using the steps in the "Rcopy" routine that I posted, with some modifications...
You could paste the rcopy code into a file, save it as rcopy.lsp (using wordpad), then load it at the command line by typing: "load rcopy.lsp", then type "rcopy" and follow the prompts... To do this, the lisp file needs to be in Acad's search path, or you need to specify the path completely when you load it. Loosing strength, cannnt' keeeppppp finggggersssssssss muvinngggg. gud nite
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
It looks like your bit of macro button code might work if you just use "P" (Previous) instead of "L" (Last) when you want to change layers. Last is just that: the last entity that was created, where previous is the previous selection set.
The idea of doing this with lisp seems good, since it allows you to delete the copies if the user cancels...
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
How do you copy and place the copy somewhere else othere than on top of the original and still be able to select it with p or l
if everyone helps everybody the world will be a better place
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
Do you even know how to utilize AutoLISP? If you were to take the power of the AutoLISP that was posted in this thread, all you'd need to do if put the call to the LISP routine in your button. Button still works and you have the greater ability of a LISP routine.
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
if everyone helps everybody the world will be a better place
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
Previous means the previous selection set.
It should not matter to you or your users whether the copies (which are exact copies) or the original selection set is what gets moved. You can do this from the command prompt as engrmech posted above and see that you get the results desired. If you understand how to do lisp, the work is already 90% done for you, just paste the code that has been posted and modify it. This shouldn't take any "hard thinking"...
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
You are thinking too hard.
To address your point about "what if the original block had attributes and you didn't want it populated..."
Are you keeping in mind what it you are trying to do here? If you make a copy of an attributed block, both the original and the copies have the attributes, even if "last" didn't return just the last single entity, but returned the "last bunch" of stuff, the attributes would still be there, "populated with the same stuff". The originals have the attributes. The copies are COPIES. You said that you wanted to make copies, move them somewhere and put them on a different layer. Given that both the original selection set and the copied set have the attributes, why do you care?
If you now have changed your mind, what do you want?
1)Not copy blocks?
2)Not copy attributed blocks?
3)Re-Insert any blocks that were in the selection set?
4)Edit the attributes of any blocks that were copy/moved/layerchanged?
RE: HOW DO YOU SELECT THE LAST ITEMS COPIED ??
It would be nice if you would sum up the information here into a FAQ.