Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Copy distance input when using copy multiple

18 REPLIES 18
SOLVED
Reply
Message 1 of 19
allstardrafter
3058 Views, 18 Replies

Copy distance input when using copy multiple

Hi all,

I was curious if there was any way to change Autocad's copy multiple command to be more like Revit. In Revit when coping an object multiple times, the distance to the next placement is tracked from the previous placement. So if I was coping an object 3 times at distances of 4' then 6' then 8', that is exactly the input I'd use, 4', 6',8'. Whereas in Autocad, copying an object 3 times at those distances my input would have to be 6', then 10', then 18', because Autocad tracks from the location of the original object being copied, so the distances have to added together. Does anyone know if that's an option that can be changed in Autocad? Obviously that example is fairly easy to add, but if distances between are random feet, inches, & fractions, then the math gets really tricky to do as running addition. Hope this makes sense!

Thanks 

18 REPLIES 18
Message 2 of 19
Patchy
in reply to: allstardrafter

There are a bunch of autolisp out there to do just that.

Copy.JPG

Message 3 of 19
ВeekeeCZ
in reply to: allstardrafter

COPYM command you know?

Message 4 of 19
allstardrafter
in reply to: ВeekeeCZ

CopyM would work, but it won't take keyboard entry distances? I'll check my pointer entry setting....

Message 5 of 19
RobDraw
in reply to: allstardrafter

OSnap and Polar Tracking can get it done without LISP.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
Message 6 of 19
allstardrafter
in reply to: RobDraw

Osnap and polar doesn't work for me. Each time I try to input a distance, it just says invalid entry.....

Message 7 of 19
pendean
in reply to: allstardrafter

@allstardrafter You ignored reply #2: do you need help understanding, finding and running LISP files in AutoCAD? There is nothing built-in to do what you want, you will need to customize with LISP.

Message 8 of 19
RobDraw
in reply to: allstardrafter

Well that means you are not inputting the distance correctly.  I've been using them for years. They can do quite a bit when used correctly. 


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
Message 9 of 19
allstardrafter
in reply to: pendean

@pendean 

Yeah, I guess I haven't found a lisp that has worked either. Or I haven't implemented one correctly. (quite likely, LOL) 

Message 10 of 19
allstardrafter
in reply to: RobDraw

Yeah, clearly I'm not giving Autocad want it wants. Not sure how many different ways there are to input distances? I've used polar tracking and Osnap for years in many other commands, so I'm not sure why this one isn't working? Ultimately, I'm doing something wrong, I'll have to play around with it some more. 

Message 11 of 19
RobDraw
in reply to: allstardrafter

Yeah, there are a number of options to choose from, too. Explore the settings to find what works for you. 


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
Message 12 of 19
pendean
in reply to: allstardrafter

@allstardrafter Try this lisp below

 

;Lisp von Marko Ribar
;http://www.cadtutor.net/forum/showthread.php?82934-Accumulative-copy-lisp&p=655507#post655507
(defun c:ccdd ( / *error* ss cm p pp osm d dl v pn DD )

 (defun *error* ( msg )
   (if cm
     (setvar 'copymode cm)
   )
   (if osm
     (setvar 'osmode osm)
   )
   (if msg
     (prompt msg)
   )
   (princ)
 )

 (setq ss (ssget "_:L"))
 (setq cm (getvar 'copymode))
 (setvar 'copymode 0)
 (setq p (getpoint "\nPick or specify base point : "))
 (setq pp (getpoint "\nPick or specify direction vector point : " p))
 (setq DD (distance p pp));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (setq osm (getvar 'osmode))
 (setvar 'osmode 0)
 (while 
   (progn
     (initget 2)
     (setq d (getdist "\nSpecify distance <Exit> : "))
  (setq d (+ d DD))
   )
   (if d
     (progn
       (setq dl (cons d dl))
       (setq v (mapcar '/ (mapcar '- pp p) (list (distance p pp) (distance p pp) (distance p pp))))
       (setq pn (mapcar '+ p (mapcar '* v (list (apply '+ dl) (apply '+ dl) (apply '+ dl)))))
       (command "_.COPY" ss "" "_non" p "_non" pn)
     )
   )
 )
 (*error* nil)
);end

 

Message 13 of 19
ВeekeeCZ
in reply to: allstardrafter

Here's the trick. No LISP required.

Select objects, run COPY, pick a base point.

Then type FROM, hit Up-Arrow key and confirm the previous point.

Then do your Revit thing.

Message 14 of 19
allstardrafter
in reply to: pendean

@pendean 

Thanks for this. I feel like I tried this one earlier today, but couldn't get it to work. 

If you don't mind, walk me through this, cause I'm assuming I'm creating it wrong....

I'm going to copy this text into a notepad file, then save it as a .lsp file. 

I'll place that .lsp file into my support folder, and I can use appload command to load it. 

My questions are:

1. Does it matter what I save the .lsp file as? (what I name it)

2. How do I then start the command when I want to use it? (command prompt keystrokes?)

Message 15 of 19

Are you talking about a series of successive copies all in the same direction, that is, for results that are in a straight line even if unequally spaced?  Or might you want to change direction for any of them, and have the newest copy placed both in a different direction and at a different distance from the last copy?  The code in Message 12 works differently than I expected as to distances, but in any case works only in one direction.

Kent Cooper, AIA
Message 16 of 19
ВeekeeCZ
in reply to: allstardrafter


@allstardrafter wrote:

...

I'm going to copy this text into a notepad file, then save it as a .lsp file. 

I'll place that .lsp file into my support folder, and I can use appload command to load it. 

My questions are:

1. Does it matter what I save the .lsp file as? (what I name it) NO

2. How do I then start the command when I want to use it? (command prompt keystrokes?) CCDD command


btw HERE is nice tutorial of how to use a lisp.

Message 17 of 19
Kent1Cooper
in reply to: Kent1Cooper


@Kent1Cooper wrote:

... might you want to change direction for any of them, and have the newest copy placed both in a different direction and at a different distance from the last copy?  ....


If that's the idea, THIS IS NOT "DONE" YET, but it does that:

;| CopyMultSucc.lsp [command name: CMS]
To Copy a selection multiple times in succession, with the location of
  each copy being specified relative to that of the previous copy, not to
  that of the original selection.
Kent Cooper, 11 March 2021
|;

(defun C:CMS (/ ss bp)
  (if
    (and
      (setq ss (ssget "_:L"))
      (setq bp (getpoint "\nBase point of first displacement: "))
    ); and
    (while T
      (command
        "_.copy" ss "" "0,0" "0,0"
        "_.move" ss "" "_non" bp pause
      ); command
      (setq bp (getvar 'lastpoint))
    ); while
  ); if
); defun

What it actually does is to Move the original selection around, leaving copies in its wake [including at the original location], so it re-uses the same selection repeatedly.  [That's a way of letting it work with multiple-object selection -- if it were always limited to a single object, then Copy could do it, using the Last object for the selection each time.]

 

The "not done yet" parts?  It requires ESCape to end it [you'll get interesting but unintended results if you hit Enter/space when it's asking for a new location, and it will continue to ask again].  And when you do stop it, it leaves two copies of the selection at the last location.  It needs some kind of non-ESCape way of concluding so that it can eliminate the duplicate at the end.

 

But you can specify the new location relative to the previous one in any direction, and by either picking a point or "aiming" and typing in a distance.  Because it's working in an ordinary command, Ortho and Osnap settings are honored, and you see what's being Copied dragging as you go.  You wouldn't with something like a (getpoint) function for each new location, which is why [I'm not sure without working it out, but] that benefit may be lost in altering it as I'd prefer, to use a prompt with <eXit> as a default option with Enter/space.

 

Anyway, try it out, and if within its limitations it otherwise does what you're after, further refinement is possible.

Kent Cooper, AIA
Message 18 of 19
RobDraw
in reply to: allstardrafter

Have you tried Move, Copy, Rotate (MOCORO)? I think it will give you what you want and so much more. All kinds of options available on the fly. You can even change the base point.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
Message 19 of 19

Thanks to all for the answers!

@pendean  - Your .lsp works great in one direction

@Kent1Cooper  - Your .lsp works perfect in all directions

@ВeekeeCZ  - Copy command, then 'From' & up arrow works great and doesn't require a .lsp at all, which is nice!

@RobDraw  - Great idea with the move, copy, rotate (mocoro) it's awesome! Probably my favorite so far as for having lots of uses. I've been using copy-rotate forever, not sure how I never knew about mocoro? 

 

I now have a much better understanding of .lsp files also, which is great, so thanks to all for your help with that!

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

Post to forums  

Forma Design Contest


AutoCAD Beta