Copy distance input when using copy multiple

allstardrafter
Contributor
Contributor

Copy distance input when using copy multiple

allstardrafter
Contributor
Contributor

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 

0 Likes
Reply
Accepted solutions (2)
3,682 Views
18 Replies
Replies (18)

Patchy
Mentor
Mentor

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

Copy.JPG

0 Likes

ВeekeeCZ
Consultant
Consultant

COPYM command you know?

0 Likes

allstardrafter
Contributor
Contributor

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

0 Likes

RobDraw
Mentor
Mentor

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.
0 Likes

allstardrafter
Contributor
Contributor

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

0 Likes

pendean
Community Legend
Community Legend

@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.

0 Likes

RobDraw
Mentor
Mentor

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.
0 Likes

allstardrafter
Contributor
Contributor

@pendean 

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

0 Likes

allstardrafter
Contributor
Contributor

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. 

0 Likes

RobDraw
Mentor
Mentor

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.
0 Likes

pendean
Community Legend
Community Legend

@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

 

0 Likes

ВeekeeCZ
Consultant
Consultant
Accepted solution

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.

0 Likes

allstardrafter
Contributor
Contributor

@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?)

0 Likes

Kent1Cooper
Consultant
Consultant

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
0 Likes

ВeekeeCZ
Consultant
Consultant

@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.

0 Likes

Kent1Cooper
Consultant
Consultant

@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
0 Likes

RobDraw
Mentor
Mentor
Accepted solution

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.
0 Likes

allstardrafter
Contributor
Contributor

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!

0 Likes