Jump to content

Rotate multiple objects using 3 points


p0peye

Recommended Posts

Hi all, I have to modify and rotate assemblies very very often on a daily bases.

 

Copy one assembly to a new location, and I have to modify it and then change the angle (I make a model for pipelines and cable-lines .

Often there is a similar part with different slope for next segment.)

What I do:

- Select assembly parts (in Advance Steel I have a custom command assigned)

- input R for rotate

- select the base point for rotation

- enter R for reference

- select the same base rotation point as before

- select second point for reference

- select the new point on target line (instead of typing angle)

 

Is there a macro or something which could allow me to

- select assembly parts

- start the command

- pick 3 points for rotate: base point, point on start line and point on target line?

 

It looks similar, but if I do this 100 times a day, and in a routine forget to select the second time base point or similar...

 

I have searched (not enough, obviously) , but most of Rotate macro/lisp are for text / block - I need it for multiple objects (using Advance Steel on ACad platform). From some toppics discussing Rotate I got an impression that Macro can't do it... Thanks in advance, cheers

Edited by p0peye
Link to comment
Share on other sites

Seems entirely possible via lisp but we'd need to know what type of entity these objects you're wanting to modify are.

Please post / upload a sample dwg if possible!

Link to comment
Share on other sites

Thanks for a quick reply :)

It looks like this...

 

(defun c:3PtRot ()
(setq sg (ssget))
(command "ROTATE" sg "" pause "R" "@" pause pause)

...will do it. (and it looks so simple. I was playing around and gave up :ouch:)

 

Works for ACad lines. Will try tomorrow if the code will do the trick for AS objects, and let you know - I was just leaving the office (allmost) when I wanted to double check if there already is a solution (hate when people are laisy to even search - and there I was... :oops: - anyway - someone else might benefit... ;))

The lisp is NOT mine - just found it on another place...

 

Cheers

:)

Link to comment
Share on other sites

If I have understood correctly:

(defun c:3pr ( / p s )
   (if
       (and
           (setq s (ssget "_:L"))
           (setq p (getpoint "\nSpecify base point: "))
       )
       (vl-cmdf "_.rotate" s "" "_non" p "_r" "_non" p "\\" "\\")
   )
   (princ)
)

Link to comment
Share on other sites

Hi Lee,

 

thank you for your code. I've tried both and both are doing the great job. :)

 

Just out of curiosity: do you think there is something wrong with the first code I've found on net (or at least could be done better), or you just wanted to show another approach to the problem?

 

Thanks either way,

 

cheers

Edited by p0peye
grammer
Link to comment
Share on other sites

. . . .I need it for multiple objects (using Advance Steel on ACad platform). From some toppics discussing Rotate I got an impression that Macro can't do it... Thanks in advance, cheers

 

 

The two macros in this post, one for scaling, the other for rotating, allow for 3 point processing of multiple objects. It does not allow for pre-selection, however. The command macro must be initiated, then object selection. The old Verb/Noun methodology.

 

 

http://www.cadtutor.net/forum/showthread.php?8142-scaling-using-object-snaps&p=46098&viewfull=1#post46098

Link to comment
Share on other sites

Then again... Not that I am not grateful for offered code, but, I was thinking...

 

Do you (or anyone else) think you could squeeze a "copy" in-front of rotate, so 1 command could do:

 

select the objects,

start Copy+3PR command,

select the point as base point of copy

select the point to insert objects and pivot

select the point start rotate

select the point for final rotate

 

I have tried to modify the 1st code (I wouldn't know where to start with Lee's . As if I did better job with this "easier" one... :?)- but it just copies the selected stuff, and it ends.

 

I am not lazy - just the know-how lacks... :ouch: and free time to try to figure it out...One of the versions:

 

(defun c:C3PR ()
(setq sg (ssget))
(command "COPY" sg pause  "ROTATE" sg "" pause "R" "@" pause pause)
)

Thank you in advance :)

Link to comment
Share on other sites

@ Seant - thanks for the reply. I have tried to figure this one by my self and I gave up. And it is not complicate, but if you mistype one character... :)

Link to comment
Share on other sites

MOCORO has some interesting options, and is applicable, but not for this problem. When Rotate is selected, it starts to measure the angle from x axe, and I need to define the starting angle...

Edited by p0peye
Link to comment
Share on other sites

Do you (or anyone else) think you could squeeze a "copy" in-front of rotate

 

Try this:

(defun c:3pr ( / c p s )
   (if (and (setq s (ssget "_:L"))
            (setq p (getpoint "\nSpecify base point: "))
       )
       (progn
           (if (setq c (getvar 'copymode))
               (setvar 'copymode 1)
           )
           (vl-cmdf
               "_.copy"   s "" "_non" "0,0,0" "_non" "@"
               "_.move"   s "" "_non" p "\\"
               "_.rotate" s "" "_non" "@" "_r" "_non" "@" "\\" "\\"
           )
           (if c (setvar 'copymode c))
       )
   )
   (princ)
)

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