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
Wouter de Haan
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.
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.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register