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

rotate ucs about Z-axis

2 REPLIES 2
Reply
Message 1 of 3
wbdehaan
845 Views, 2 Replies

rotate ucs about Z-axis

Hi,

 

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 

 

 

2 REPLIES 2
Message 2 of 3
adadnet
in reply to: wbdehaan

hi wouter

 

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

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html

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

 

felix

Message 3 of 3
wbdehaan
in reply to: adadnet

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,

 

Wouter

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