ctrlaltdel Posted September 26, 2016 Share Posted September 26, 2016 Any user here has lisp to copy an entity/entities & paste to the same location multiple times. lisp to run in this manner - select entity/entities - key in the number (to indicate how many to paste) - Enter (Please don't require user to click a base point) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 26, 2016 Share Posted September 26, 2016 I wonder what is the wisdom behind copying the same objects in the same original location many times? Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted September 26, 2016 Author Share Posted September 26, 2016 I wonder what is the wisdom behind copying the same objects in the same original location many times? Tharwat sir, the enity/entities are a reference item. I need to insert this reference item into various blocks in the same location. Therefore I need multiples of this enity/entities Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 26, 2016 Share Posted September 26, 2016 Can you give a clear example of what you are after? Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted September 26, 2016 Author Share Posted September 26, 2016 Can you give a clear example of what you are after? Tharwat sir. Here is a photo & dwg file. I fogot to add in the photo, that preferable no base point input is required from user. Just paste the multiples on the top of the original. PASTE MULTIPLE FUNCTION.dwg Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 26, 2016 Share Posted September 26, 2016 Try this; (defun c:Test (/ cm ss in) (if (and (setq ss (ssget "_:L")) (setq in (getint "\nSpecify number of copies :")) ) (progn (setq cm (getvar 'CMDECHO)) (setvar 'CMDECHO 0) (repeat in (command "_.COPY" ss "" '(0. 0.) '(0. 0.)) ) (setvar 'CMDECHO cm) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted September 26, 2016 Share Posted September 26, 2016 @ Tharwat: Maybe add "_non" (2x) just in case... Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 26, 2016 Share Posted September 26, 2016 @ Tharwat: Maybe add "_non" (2x) just in case... You are right Roy, honestly I have noticed that after a few minutes of posting the codes and intended to wait for OP's reply if they might need any changes and would cover that issue in the next mods. Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted September 27, 2016 Author Share Posted September 27, 2016 Try this; (defun c:Test (/ cm ss in) (if (and (setq ss (ssget "_:L")) (setq in (getint "\nSpecify number of copies :")) ) (progn (setq cm (getvar 'CMDECHO)) (setvar 'CMDECHO 0) (repeat in (command "_.COPY" ss "" '(0. 0.) '(0. 0.)) ) (setvar 'CMDECHO cm) ) ) (princ) ) Tharwat sir. work as i wanted. Thanks so much. What is "_non" (2x) about. important? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 27, 2016 Share Posted September 27, 2016 This question is almost identical to this http://www.cadtutor.net/forum/showthread.php?98213-Copy-text-into-same-place-but-in-different-layer from a couple of weeks ago. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 27, 2016 Share Posted September 27, 2016 Tharwat sir. work as i wanted. Thanks so much. You are welcome. What is "_non" (2x) about. important? Like the following adds and this should ignore the settings of your object snap settings to place the newly created objects in their correct place. (defun c:Test (/ cm ss in) (if (and (setq ss (ssget "_:L")) (setq in (getint "\nSpecify number of copies :")) ) (progn (setq cm (getvar 'CMDECHO)) (setvar 'CMDECHO 0) (repeat in (command "_.COPY" ss "" "_none" '(0. 0.) "_none" '(0. 0.)) ) (setvar 'CMDECHO cm) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted September 27, 2016 Author Share Posted September 27, 2016 This question is almost identical to this http://www.cadtutor.net/forum/showthread.php?98213-Copy-text-into-same-place-but-in-different-layer from a couple of weeks ago. came across it as well. far more complex. Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted September 27, 2016 Author Share Posted September 27, 2016 Thanks Tharwat for the explanation. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 27, 2016 Share Posted September 27, 2016 Thanks Tharwat for the explanation. Good luck. Enjoy. Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted September 27, 2016 Share Posted September 27, 2016 Another : (defun c:test ( / ss n i e ) (vl-load-com) (if (and (setq ss (ssget "_:L")) (not (initget 7)) (setq n (getint "\nHow many copies : ")) ) (repeat (setq i (sslength ss)) (setq e (ssname ss (setq i (1- i)))) (repeat n (vla-copy (vlax-ename->vla-object e)) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
ctrlaltdel Posted September 28, 2016 Author Share Posted September 28, 2016 Thanks marko_ribar. This works as well. Another : (defun c:test ( / ss n i e ) (vl-load-com) (if (and (setq ss (ssget "_:L")) (not (initget 7)) (setq n (getint "\nHow many copies : ")) ) (repeat (setq i (sslength ss)) (setq e (ssname ss (setq i (1- i)))) (repeat n (vla-copy (vlax-ename->vla-object e)) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.