Jump to content

Copy and rotate multiple


Romero

Recommended Posts

Hello everyone.

 

I am working with a code to copy object (s) and paste with rotation using the same base point as the axis of rotation.

What I can't do is create a while cycle to be able to make multiple copies and rotate. I could only do it once. If someone helps me a little I would be very grateful.

 

(defun c:cr (/ ss p1 p2 p3)
  (setq ss (ssget))
  (command "copy" ss "" "0" "0")
  (setq p1 (getpoint "\n base Point: "))
  (setq p2 (getpoint "\n destination point: "))
  (command "move" ss "" p1 p2)
  (setq p3 (getpoint "\n reference point: "))
  (command "rotate" ss "" p2 "R" "@" p3 pause)
)

 

Link to comment
Share on other sites

Perhaps something like this?

(defun c:cr ( / p q r s )
    (if
        (and
            (setq s (ssget "_:L"))
            (setq p (getpoint "\nSpecify base point: "))
            (setq q (getpoint "\nSpecify destination point: " p))
            (vl-cmdf "_.move" s "" "_non" p "_non" q)
            (setq r (getpoint "\nSpecify reference point: " q))
        )
        (while (vl-cmdf "_.rotate" s "" "_non" q "_C" "_R" "@" "_non" r "\\"))
    )
    (princ)
)

 

Link to comment
Share on other sites

6 hours ago, Lee Mac said:

 Perhaps something like this?

 

Hi @Lee Mac, thank you very much for your response. I really appreciate the help, but unfortunately it's not what I wanted.

Maybe I didn't know how to explain myself well, and it's all my fault.

 

I will try to explain it better to see if it is possible to help me:
The problem is that I want to copy the same object, but I have to put several points: (destination point)

 

1.-I want to designate objects and be able to create multiple copies
2.-But when you copy the object, it can be rotated with a reference, which begins at the base point
(So far I have no problem)
3.- without abandoning the command, copy the same object again, to create another copy and rotate it in the same way;

For that, I would have to create a new point (destination point), but I can't solve it.
4.-repeat until canceled.

Edited by Romero
Link to comment
Share on other sites

It is best to provide a drawing before processing and processing, so that everyone can help you.

Edited by SLW210
Removed Quote
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...