Valued Contributor
64 Posts
2 Kudos
Registered: ‎11-01-2001
Post 1 of 3

rotate ucs about Z-axis

562 Views, 2 Replies
03-22-2012 08:15 AM



when you have a 3D-object, with a specific origin, i would like to know how it is positioned in space, X, Y, and Z coordinates, but also A, B, and C (like Tilt, Roll, Pitch), where A is rotation Angle around Z-axis, B around Y-axis, and C around X-axis. I am using this for a kuka robot


i can change the position of the UCS, but don't know how to only rotate the ucs about the Z-axis


'--- Set origin of UCS icon

acUCSTblRec.Origin = Psource(0)

acUCSTblRec.XAxis = Psource(0).GetVectorTo(Psource(1))

acUCSTblRec.YAxis = acUCSTblRec.XAxis.GetPerpendicularVector




kind regards


Wouter de Haan 



Valued Contributor
95 Posts
1 Kudo
Registered: ‎11-15-2011
Post 2 of 3

Re: rotate ucs about Z-axis (link corrected)

03-27-2012 12:55 PM in reply to: wbdehaan

hi wouter


there's much about coordinate systems in the developer guide starting here



(contents tab / 'work in three-dimensional space' header)


effectively you define an object coordinate system for your object (or entity coordinate system) in form of an ucstablerecord by setting origin and 2 axis, e.g. origin and an x and y vector at an angle (e.g. as you've shown), and add it to the ucstable. you then transform the coodinates from the ocs (or ecs) to the world coordinate system and vice versa. the matrix3d.aligncoordinatesystems() returns a transformation matrix for use in any coordinate's .transform() method.


going back to your question, if i understand you right then you have to first define the ocs (or ecs), then define the A, B and C ucs and then transform the object coordinates from ocs to ucs via object.transform(ocs2ucs()_matrix3d) and then transform the respective ucs to wcs via object.transform(ucs()2wcs_matrix3d). - provided you are apt with matrices, you can combine the two steps into one by multiplying the two matrices.


on second thought, provided the ocs (or ecs) is already equal to wcs you could make do with 3 transformations, from ucs() to wcs.


personally, i found it essential to go through the pages in the developer's guide first, but hope this helps.



Valued Contributor
64 Posts
2 Kudos
Registered: ‎11-01-2001
Post 3 of 3

Re: rotate ucs about Z-axis (link corrected)

04-06-2012 04:39 AM in reply to: FFlix

Thanks for your answer! I finally managed to get it working!


The problem was that I first had to rotate about the Z-axis in line with the object, that gave me the A-axis orientation, and after that, and after that calculate the angle between the XZ-plane which gave me the B-axis en YZ-plane that resulted in the C-axis.


kind regards,



Post to the Community

Have questions about Autodesk products? Ask the community.

New Post