Rotate a drawing

Rotate a drawing

eyal.ch
Collaborator Collaborator
1,344 Views
18 Replies
Message 1 of 19

Rotate a drawing

eyal.ch
Collaborator
Collaborator

Hi everybody,

I need a lisp that after calling it, it will show 2 options:

1. to select a line to rotate,

2. to restore the original view.

 

for example I have this drawing:

eyalch_0-1689835545458.png

I want that by selecting a line in the model it will rotate all the drawing so it will be horizontally with this line.

(like in UCS object). and when I call the lisp again and choose the second option - to restore- it will restore the original rotated position.

( I know I can do these options by UCS) , but I want to do these in 2 clicks:

1. by selecting a line- it will rotate.

2. by choosing restore - it will restore the view.

 

thank you.

 

0 Likes
Accepted solutions (1)
1,345 Views
18 Replies
Replies (18)
Message 2 of 19

Moshe-A
Mentor
Mentor

@eyal.ch  hi,

 

1. when using the UCS command it rotate the whole model, as i can understand you do not want that?!

2. if 1 is true, what about objects on off, freeze, locked layers?

3. if after the align to horizontal position you add more objects in that part of the drawing but it could be else where

    how can the lisp know which objects is part of the rotate (for the restore option) and which are not

    you have to define some known boundary for that.

4. are you familier with ALIGN command?

 

Moshe

 

Moshe

 

0 Likes
Message 3 of 19

eyal.ch
Collaborator
Collaborator

Hi @Moshe-A ,

 

I'm familiar with the align command and it align the model with the horizontal line but I need the rotation to be temporary like when you rotate with UCS command.

tha't exactly what I need, and it is for rushing the work,( I know jow to work with ucs and with align) but:

 

I want by clicking only 1 line from the rotated model , the all drawing will be rotated ( like in the ucs) and will let me work on it or print it and then when I want the model to be like its original position, I will call the lisp again and choose to restore.

0 Likes
Message 4 of 19

Moshe-A
Mentor
Mentor

The ucs command has object\entity option are you familier with that?

0 Likes
Message 5 of 19

Kent1Cooper
Consultant
Consultant

I just want to be sure I understand what you want to do -- to actually ROTATE all the drawn objects in the drawing, without changing the UCS or the View?  If so, there's no issue with object selection for Rotating back in a restore option, whether anything has been added or deleted -- just Rotate ALL objects.  But it does raise questions:

 

As already asked, what about things on Off/Frozen/Locked Layers?  Should it save a Layer State, Thaw and turn On all Layers, then Rotate everything, and should part of the restore option be to restore the Layer State after Rotating everything back?

 

What should be the base point for the Rotate command?  The picked point?  Some Osnappable location on the picked object, such as an ENDpoint or MIDpoint?

 

Should it test that you have picked on something straight?  Or if you pick on a curve, should it use the direction of that at the pick point?  [That would give different results depending on exactly where on it you pick.]

 

What should determine which way along the selected object is the X-axis direction from the Rotate base point?  Would you care whether it sometimes put things more like up-side-down, because of the drawn direction of that object?

 

Etc., etc.

Kent Cooper, AIA
0 Likes
Message 6 of 19

eyal.ch
Collaborator
Collaborator

Hi @Kent1Cooper and @Moshe-A ,

 

No, I want to explain again:

I want to do exactly this, but in 2 clicks.

1. to choose a line from the rotated drawing and it will rotate the drawing horizontally according this line.

2. click restore and get the drawing position back as it initially was.

 

usually you could do what I want like this example:

1. I want to rotate the drawing according the red rectangle base line.

eyalch_0-1689857228338.png

I click UCS and click OBJECT and then I can select the line of the rotated element.

eyalch_3-1689857682971.png

click the text TOP in the middle of the cube and it will be rotated

eyalch_4-1689857702205.png

 

eyalch_1-1689857397504.png

the model will be rotate and I can work on it or print it.

then if I want to restore the original position I type UCS again and select WORLD 

eyalch_2-1689857510331.png

that's what I need, but instead of doing it with a lot of commands, I want it to be quickly.

thank you

 

0 Likes
Message 7 of 19

dbroad
Mentor
Mentor

You don't need a lisp program to do that.  Just set ucsfollow to 1.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 8 of 19

Kent1Cooper
Consultant
Consultant

@dbroad wrote:

You don't need a lisp program to do that.  Just set ucsfollow to 1.


... and use the UCS OBject option and select the desired edge.

Kent Cooper, AIA
0 Likes
Message 9 of 19

dbroad
Mentor
Mentor

Or ucs e

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 10 of 19

Kent1Cooper
Consultant
Consultant

@dbroad wrote:

Or ucs e


Interesting....  How is one supposed to know of that option [however unnecessary it may be, given the existence of the OBject option]?  It's not in the prompt, nor included in Help for the command.  If I assume that it's an initial for something not listed in the prompt, and try typing in assumed somethings like Existing or Edge, it doesn't accept those as options.  Do you know what it's for?

Kent Cooper, AIA
0 Likes
Message 11 of 19

Moshe-A
Mentor
Mentor

@Kent1Cooper 

 

long time ago we had UCS Entity

than they changed it to UCS OBject and i assume Entity is still there for those old applications.

 

Moshe

 

 

0 Likes
Message 12 of 19

dbroad
Mentor
Mentor

You've just had to have been an AutoCAD user for a long time(be old). It used to be there. Some coder at some point thought it'd be cooler to call them objects instead of entities.  Probably when the ActiveX became popular.  You're already familiar with enames, which stand for entity names, Autodesk's original terminology for lines, etc.

The e option is useful for one very good reason. It's easier to type and since it's legacy, it's never going away.

(defun c:ue ()(command "ucs" "e")(princ))

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 13 of 19

hak_vz
Advisor
Advisor
Accepted solution

I don't kn ow if this is what you ask but....

 

Put UCS along the object (line) you want drawing to  be horizontal, then run command PLAN.

To return to original view use UCS with Previous option and run command PLAN again.

No need for any lisp.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 14 of 19

Moshe-A
Mentor
Mentor

@eyal.ch 

 

be aware that each ucs change (and plan) must drag a regen

for such issues i recommend to explore SNAP rotate command (+ ORTHO on)

 

here is a lisp call SNR to implament this 😀

 

Moshe

 

 

 

0 Likes
Message 15 of 19

Kent1Cooper
Consultant
Consultant

@dbroad wrote:

.... Some coder at some point thought it'd be cooler to call them objects instead of entities.  Probably when the ActiveX became popular.  ....


Or maybe because all editing commands involving selection of what to work on use the "Select objects: " prompt [and I think they always have], so they figure that's the word users will be more familiar with than "entity" -- AutoLisp code geeks are accustomed to that, but how common a word is it, really?

Kent Cooper, AIA
0 Likes
Message 16 of 19

eyal.ch
Collaborator
Collaborator

Hi @hak_vz ,

That's exactly what I do, but if it's the fast way , I keep doing it.

 

thank you all.

 

0 Likes
Message 17 of 19

hak_vz
Advisor
Advisor

@eyal.ch wrote:

Hi @hak_vz ,

That's exactly what I do, but if it's the fast way , I keep doing it.


You can use named views. Changing from one named view to other practically takes same amount of time. I personally use PLAN command. In case when you have more then one drawings in same model space named views may be faster.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 18 of 19

Sea-Haven
Mentor
Mentor

If you pick an object like a line can get the angle, so make a view based around say the pick end pt, but with a rotated view, need to save a "world" view 1st. Found this how do I entmake a view? - Autodesk Community - AutoCAD

 

So if run the (setq ViewData (entget (tblobjname "view" "ValidViewName"))) it reveals lots of answers. need to think about it maybe try on some real dwgs so can work out some of the dxf values.

0 Likes
Message 19 of 19

john.uhden
Mentor
Mentor

@eyal.ch ,

I guess you are not a Civil.

When xreffing dwgs we don't want them to end up in positive or negative outer space.  So rather than rotating the world, we rotate the camera by using DVIEW;TWIST.  That way everything can reside in the same WCS, and all references can be inserted at 0,0,0 so there's no "racking" required.

Try it.  You may come to like it.

Then again, if your an architectural type, you're gonna do what you want and to hello with the engineers.

John F. Uhden

0 Likes