Jump to content
alanjt

ZeroRotation.lsp Set rotation of objects to zero (based on current UCS)

Recommended Posts

alanjt

A request in another thread made me dig this up and do a little updating. I thought I'd post it for you good people.

 

This will rotate all selected MText, Text, Multileaders and Blocks to match the current UCS (basically, rotates everything to zero).

 

ZeroRotation.gif

 

 

Updated: 05.31.11

ZeroRottaion.LSP

Edited by alanjt

Share this post


Link to post
Share on other sites
Glen Smith

Alan,

 

Cool program, I'm not sure if I understand what it should do. I drew some text at various angles and ran the code which rotated the text to 0 degrees. That makes sense.

 

Then I set a UCS on an angle and tried again, but the text did not rotate.

 

Should the text only rotate to 0 deg in its own plane, or is it supposed to be able to change the plane of the text as well?

 

I guess a diffferent way to ask my question is - is this a 2D or 3D application?

 

Glen

Share this post


Link to post
Share on other sites
alanjt
Alan,

 

Cool program, I'm not sure if I understand what it should do. I drew some text at various angles and ran the code which rotated the text to 0 degrees. That makes sense.

 

Then I set a UCS on an angle and tried again, but the text did not rotate.

 

Should the text only rotate to 0 deg in its own plane, or is it supposed to be able to change the plane of the text as well?

 

I guess a diffferent way to ask my question is - is this a 2D or 3D application?

 

Glen

 

It's a 2D application. I have very little experience with working in actual 3D. Civil 3D is all 3D models, but for actually display purposes, you just show the plan, profile and cross sections. I'd have to play with it to get it to work with a 3D plane.

Share this post


Link to post
Share on other sites
caddmandew

Alan

 

This is exactly what I was looking for. I have tried to create my own, but without success. Would you mind sharing the file?

 

Thanks in advance

Jim

Share this post


Link to post
Share on other sites
alanjt
Alan

 

This is exactly what I was looking for. I have tried to create my own, but without success. Would you mind sharing the file?

 

Thanks in advance

Jim

Oops, forgot I'd removed it. Code re-posted.

Share this post


Link to post
Share on other sites
caddmandew

Thanks and have a great day

Share this post


Link to post
Share on other sites
alanjt
Thanks and have a great day

You're welcome. Come and hang out. Since you have but three posts and they all were made today, I'd welcome you to the forums, but I notice you've been a member for quite some time.

Share this post


Link to post
Share on other sites
Least

cheers alan, this will be quite useful.

Share this post


Link to post
Share on other sites
Lee Mac

Alan,

 

Nice idea for the program :)

 

But be careful when the UCS plane is not the same as the WCS plane, since the UCSXDIR System Variable is expressed relative to the WCS plane.

 

An example:

 

ZeroRotationBug.gif

 

The fix, change:

 

(setq xdir (getvar "ucsxdir"))

to:

 

(setq xdir (trans (getvar "ucsxdir") 0 (trans '(0. 0. 1.) 1 0 t)))

I would also be inclined to bound the UCS Angle to a variable prior to iterating through the SelectionSet to save recalculating the angle each time.

 

Lee

Share this post


Link to post
Share on other sites
alanjt
Alan,

 

Nice idea for the program :)

 

But be careful when the UCS plane is not the same as the WCS plane, since the UCSXDIR System Variable is expressed relative to the WCS plane.

Yes, I know and I know the fix, but if you had noticed, I hadn't updated this program since late 2009. However, since you pointed this out, I went ahead and gave it a complete overhaul. I even noticed that in April of last year, I had updated my AT:UCSAngle subroutine to work properly. Oh well, I never noticed, but it should be good to go now. Thanks for the nudge to update.

 

Updated in first post.

update.gif

Share this post


Link to post
Share on other sites
Lee Mac

Just making you aware...

Share this post


Link to post
Share on other sites
alanjt
Just making you aware...

appreciated.

Share this post


Link to post
Share on other sites
abra-CAD-abra

alanjt et al,

 

I am trying to modify this code to allow for the rotation of block content in MLeaders, however, I cannot find any VLA properties or methods associated with the rotation of block content in a multileader. I am using the following resource as suggested by Lee Mac in another post:

 

C:\Program Files\Common Files\Autodesk Shared\acadauto.chm

 

A really good resource which I never knew existed - Thanks Lee Mac!

 

Cheers,

Share this post


Link to post
Share on other sites
alanjt
alanjt et al,

 

I am trying to modify this code to allow for the rotation of block content in MLeaders, however, I cannot find any VLA properties or methods associated with the rotation of block content in a multileader. I am using the following resource as suggested by Lee Mac in another post:

 

C:\Program Files\Common Files\Autodesk Shared\acadauto.chm

 

A really good resource which I never knew existed - Thanks Lee Mac!

 

Cheers,

 

If I remember correctly, the rotation property of a block within a MLeader wasn't available. Actually, looking at one in the properties palette now, it's not even available there. I don't use many MLeaders with blocks, but for the few I do, if I do have to rotate them, I just use the rotate command. I didn't code this in because using rotate doesn't really work the same as 'put'ing a rotation, and since you don't really have a rotation to extract to begin with, there isn't much to work with on a reference for your new rotation angle.

If I have time, I might dig into it some more.

Share this post


Link to post
Share on other sites
abra-CAD-abra

Alan,

 

Thanks for your response and explanation. I had an inkling that this would be a manual task.

 

In any case, a great routine which sits at the forefront of my custom menu. If I could count which lisps are used the most, this would be up there - Top stuff! I also like the AT:UCSAngle function. :thumbsup:

 

Cheers,

Share this post


Link to post
Share on other sites
danglar

Very good programm! But I have a question. Is it possible to rotate All the entities, as mentioned in a first post, to zero relative to current UCS?

Share this post


Link to post
Share on other sites
funkkybebel

I have got used to rotate the cursor (to simulate UCS rotate) with Lee's lisp "CursorRotateV1-0.lsp".

I though it would work with that, but no. I have to totate UCS to make it works.

 

Thnak anyway, it's really useful.

Share this post


Link to post
Share on other sites
amb2301
A request in another thread made me dig this up and do a little updating. I thought I'd post it for you good people.

 

This will rotate all selected MText, Text, Multileaders and Blocks to match the current UCS (basically, rotates everything to zero).

 

[ATTACH]15045[/ATTACH]

 

 

Updated: 05.31.11

 

Thanks for your lisp alanjit, if possible could you please look on to my request posted(Lisp required to make text rotated to 0 angle & make changes in font style & height)?

 

i need a help in creating a lisp, actually i have drawing with lot (nearly thousands of text to converted in a single drawing file) of text to be converted from different angles to zero angle & also to change its text height & font style as shown in attached .dwg file,

Another important thing is i need to remove the / symbol from that text & re-arrange as shown in the attached .dwg file.

Kindly look on this & requesting to please provide lisp for this work.

Also to remove the text P50/ ,like whatever text starts with P & ends with / to be removed.....is it possible? please help urgent help required.

TEXT CONVERTION.dwg

Share this post


Link to post
Share on other sites
nanjac86

Dear alanjt ,

 

Works perfect. thank very much.

Share this post


Link to post
Share on other sites
danglar

Is it possible to add polylines to set of entities for zero rotation?

probably based on this approach?

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rotate-a-selected-side-of-a-polyline-to-zero-degrees-in-autolisp/m-p/7563715/highlight/false#M361760

 

 

now it works only for Blocks ,MTEXTs,*LEADERs and TEXTs.

With this addition it can works for polylines too

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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