PDA

View Full Version : ZeroRotation.lsp Set rotation of objects to zero (based on current UCS)



alanjt
23rd Oct 2009, 04:31 pm
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).

15045


Updated: 05.31.11

Glen Smith
23rd Oct 2009, 05:43 pm
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

alanjt
23rd Oct 2009, 05:52 pm
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.

caddmandew
26th May 2011, 07:07 pm
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

alanjt
26th May 2011, 07:08 pm
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
JimOops, forgot I'd removed it. Code re-posted.

caddmandew
26th May 2011, 07:12 pm
Thanks and have a great day

alanjt
26th May 2011, 07:15 pm
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.

Least
27th May 2011, 01:15 pm
cheers alan, this will be quite useful.

Lee Mac
27th May 2011, 03:35 pm
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:

27869

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

alanjt
31st May 2011, 03:51 pm
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.
27911

Lee Mac
31st May 2011, 06:23 pm
Just making you aware...

alanjt
31st May 2011, 06:25 pm
Just making you aware...
appreciated.