.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UCS rotation

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
483 Views, 4 Replies

UCS rotation

I am working in a UCS that was created by rotating the WCS around its Z
axis by certain degrees. How can I find out that angle of rotation?
Basically I need to find the angle made by the current UCS' X axis with
the WCS' X Axis. Any help is much appreciated!

Thanks!

Gagan
==============
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

{code}

Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

Vector3d v = ed.CurrentUserCoordinateSystem.CoordinateSystem3d.Xaxis;

double answer = Vector3d.XAxis.AngleTo( v );

{code}


--

http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"Gagan Gajabaharia" wrote in message news:6074591@discussion.autodesk.com...
I am working in a UCS that was created by rotating the WCS around its Z
axis by certain degrees. How can I find out that angle of rotation?
Basically I need to find the angle made by the current UCS' X axis with
the WCS' X Axis. Any help is much appreciated!

Thanks!

Gagan
==============
Message 3 of 5
chiefbraincloud
in reply to: Anonymous


This code uses Editor.CurrentUserCoordinateSystem, and returns the angle in radians.





Friend Shared Function GetUCSRotation() As Double



Try



Dim CurUcs As CoordinateSystem3d = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocum ent.Editor.CurrentUserCoordinateSystem.CoordinateSystem3d()



Dim WorldNormal As New Vector3d(0, 0, 1)



Dim CurXvec As Vector3d = CurUcs.Xaxis



Dim WorldXY As New Plane(CurUcs.Origin, WorldNormal)



Return CurXvec.AngleOnPlane(WorldXY)



Catch ex As System.Exception



EdWrite(ex.Message & " In: " & ex.Source & vbCrLf & ex.StackTrace & vbCrLf)



Return Nothing



End Try



End Function

Dave O.                                                                  Sig-Logos32.png
Message 4 of 5
Anonymous
in reply to: Anonymous

Tony Tanzillo wrote:
> {code}
>
> Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
>
> Vector3d v = ed.CurrentUserCoordinateSystem.CoordinateSystem3d.Xaxis;
>
> double answer = Vector3d.XAxis.AngleTo( v );
>
> {code}
>
>
Thanks, Tony! I got the idea..

Gagan
=============
Message 5 of 5
Anonymous
in reply to: Anonymous

chiefbraincloud wrote:
>
> This code uses Editor.CurrentUserCoordinateSystem, and returns the angle
> in radians.

> Friend Shared Function GetUCSRotation() As Double

> Try

> Dim CurUcs As CoordinateSystem3d =
> Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocum
> ent.Editor.CurrentUserCoordinateSystem.CoordinateSystem3d()
> Dim WorldNormal As New Vector3d(0, 0, 1)
> Dim CurXvec As Vector3d = CurUcs.Xaxis
> Dim WorldXY As New Plane(CurUcs.Origin, WorldNormal)
> Return CurXvec.AngleOnPlane(WorldXY)
> Catch ex As System.Exception
> EdWrite(ex.Message & " In: " & ex.Source & vbCrLf & ex.StackTrace & vbCrLf)

> Return Nothing

> End Try
End Function
>

Thanks, Chief!

Gagan
============

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost