Jump to content

Copy relative to last copy location function?


EntDraught

Recommended Posts

Hi Guys,

 

You know how on the copy command you can select a general direction and keep copying relative to the base point? Well, I'd like to do that but would like the copy distance to be relative to the last copy point.

 

In case it's not clear I'll offer an example:

 

Create a circle at points 0,0,0.

 

I would like to copy the circle every 10 ft. along the x axis for 100 ft. Instead of continually entering copy points of 10,20,30,40,50 etc. from the base point of 0,0,0 I would like to start at 0,0,0 but enter [copy] and for distances enter 10,10,10,10 and have each copied circle advance from the last copy's point 10 feet or whatever distance I need.

 

In real life these points for me would vary so it wouldn't be a constant 10 ft., or an even length, it would vary.

 

It seems like a simple LISP routine could handle this but I would like to know if this function exists within autocad before I reinvent the toaster oven...

 

thanks in advance!

Link to comment
Share on other sites

Psst MSasu... the OP said,

 

In real life these points for me would vary so it wouldn't be a constant 10 ft., or an even length, it would vary.
Link to comment
Share on other sites

Sounds like there's nothing native in cad for this command so I'll just draft up a lisp - should be pretty straight forward.

 

Thanks,

Link to comment
Share on other sites

Here is a relatively simple program:

 

(defun c:copyrel ( / b i l p q s )
   (if
       (and
           (setq s (ssget "_:L"))
           (setq p (getpoint "\nSpecify Base Point: "))
           (setq b (vlax-3D-point (trans p 1 0)))
       )
       (progn
           (repeat (setq i (sslength s))
               (setq l (cons (vlax-ename->vla-object (ssname s (setq i (1- i)))) l))
           )
           (while (setq q (getpoint "\nSpecify Second Point: " p))
               (foreach x l (vla-move (vla-copy x) b (vlax-3D-point (trans q 1 0))))
               (setq p q)
           )
       )
   )
   (princ)
)
(vl-load-com)
(princ)

 

Or, if you have Express Tools installed:

 

(defun c:copyrel ( / b i l o p q s )
   (if
       (and
           (setq s (ssget "_:L"))
           (setq p (getpoint "\nSpecify Base Point: "))
           (setq b (vlax-3D-point (trans p 1 0)))
       )
       (progn
           (repeat (setq i (sslength s))
               (setq l (cons (vlax-ename->vla-object (ssname s (setq i (1- i)))) l))
           )
           (while (setq q (acet-ss-drag-move s p "\nSpecify Second Point: " 0 0))
               (setq s (ssadd))
               (foreach x l
                   (vla-move (setq o (vla-copy x)) b (vlax-3D-point (trans q 1 0)))
                   (ssadd (vlax-vla-object->ename o) s)
               )
               (setq p q)
           )
       )
   )
   (princ)
)
(vl-load-com)
(princ)

Link to comment
Share on other sites

Lee Mac, now you've gone and done it... I've been attempting new things lately and have come across older posts where you most generously offer assistance to others and now you've gone and done it to me!

 

God Bless you,

Link to comment
Share on other sites

Lee Mac, now you've gone and done it... I've been attempting new things lately and have come across older posts where you most generously offer assistance to others and now you've gone and done it to me!

 

God Bless you,

 

You're very welcome EntDraught, the programs were relatively short and quick to write, so I didn't mind offering a helping hand :)

 

Nice, Lee... I also use acet-ss-drag-move and acet-ss-drag-rotate for my CopyRotate (CORO) Command. :beer:

 

Thanks RenderMan; the acet-* functions are indeed an incredibly useful alternative to using functions such as grread to create the same visual effect, that is, providing that you can guarantee that Express Tools will be available.

Link to comment
Share on other sites

 

Thanks RenderMan; the acet-* functions are indeed an incredibly useful alternative to using functions such as grread to create the same visual effect, that is, providing that you can guarantee that Express Tools will be available.

 

I am fortunate to work with a Vertical, which comes with Express Tools OOTB I believe, and if not, IT installs for each version anyway (LoL). They just restrict us on 3rd party, or non-supported Autodesk plug-ins unfortunately.

 

In any event, you've done another (technically, two) fine job(s) here. Cheers! :beer:

Link to comment
Share on other sites

  • 5 years later...

So I know this post is old but I would love if someone could help me with edit the lisp posted by Lee Mac. I am using AutoCAD 2018 with express tools and the lisp works up until the second copy. I can't control the direction of the copy.

 

I am using it now to quickly draw a column grid. I have orthomode on. My first copy is horizontal, the second is also to be horizontal and all visual cues show as if it will be copied horizontally, just like the other copy. However, the result is that it copies the object downward. And not even to the correct distance. For example I typed in 20'-8" and it copied it 7' something down on the Y-axis.

 

This is exactly what I am looking for so if anyone can help me out with this it would be fantastic!!

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...