# Component transformation rotation

Forum Forums Visual Components 4.1 .NET Addon Programming Component transformation rotation

This topic contains 2 replies, has 3 voices, and was last updated by  Jay 5 months, 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
• Author
Posts
• #13854

SimonS
Participant

Hello together,

i am set a transofrmation of a component like this:

var component = this.SimApplication.World.FindComponent(componentName);
var matrix = component.TransformationInWorld;
matrix.Px = 100
matrix.Py = 200
matrix.Pz = 300
matrix.RotateAroundZ(90);
component.TransformationInWorld = matrix;

After that the position in the visualisation is ok. And the matrix x, y and z parameters of the .NET object are equals with the setted values 100, 200 and 300). But I can`t find any property of which has the value for the “rotationAroundZ”. Also not in another unit (radians).

Thank you.

#13880

Keke
Moderator

Hi,

You need to learn more about rotation (and transformation) matrices to understand why this is. Wikipedia has fairly decent article on this:

http://en.wikipedia.org/wiki/Rotation_matrix

Briefly put the rotation around Z (or X or Y) affects more than one value inside the matrix and that is why there is no single property that shows it. Rather you need to calculate the RZ from multiple values inside the matrix.

Of course in the API there could be a property called RZ, that would return the computed value for the angle. Like it is done with the Determinant property.

-k

#13881

Jay
Moderator

You can set the orientation of the component’ matrix in world using specified yaw, pitch and roll vector values.

Vector3 vec = new Vector3(90, 30, 20);
_app.World.Components.Last().TransformationInWorld.SetWPR(vec);

and you can get the matrix orientation as follows

vec.X = _app.World.Components.Last().TransformationInWorld.GetWPR().X;
vec.Y = _app.World.Components.Last().TransformationInWorld.GetWPR().Y;
vec.Z = _app.World.Components.Last().TransformationInWorld.GetWPR().Z;

Hope that helps.

#13899

SimonS
Participant

Thank`s for answers.`

``` @Keke:I Knwo it to set the rotation is more as only to set only values. But I thought that after the operation I can read that values anywhere, because I see also the values in the KUKA.Sim UI. @Jay: Your answer has solved my problem. ```

`Thak`s for your support!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.