set Orientation of Matrix to World Matrix

hey there!

Is there a way to set the orientation of a Component Position Matrix to the World Matrix? Creating a new Matrix and getting its WPR doesn’t work apparently?

Best Regards!


A newly created matrix will always have the default value of 0,0,0.

I don’t know what you’re trying to achieve, but you can use matrix multiplication with other matrices using the * operator.

If you give a better explanation of what you’re trying to achieve maybe, I can help you better.




Hi JobW!

First of all thanks for your answer!

I want to create a matrix at the origin of a certain component using:


Of course this matrix has the orientation of the origin, but since i’m trying to change this component and i can’t garantuee that the orientation will always be the same i want to “reset” the orientation of this matrix to the world orientation (rx=0,ry=0,rz=0) but keep its position in the world, so i can give exact rotations via script without measuring and having to adapt the script over and over again.

I hope one can understand what im trying to say.

Best regards


I’ve attached a component with some examples of matrices, world positions and setWPR.

I tried to understand what you were saying, but it was hard for me to understand.
If this component doesn’t help, maybe you can share an example component with the thing you’ll like to achieve.




Test-matrix.vcmx (25.8 KB)

If a component is not attached to another component (parent is World root node) then try this pseudo-code.

from vcScript import *
import vcMatrix

m =
pm = getComponent().WorldPositionMatrix
m = m * pm

#new matrix should be at component origin
print m.P.X, m.P.Y, m.P.Z

If a component is attached to another component (parent is node of other component) then do the same as above.

NB! You can use PositionMatrix attribute if component is attached to world root node because it would give same result as WorldPositionMatrix attribute.

When we get into feature level then you need to be more aware of how the feature is organized to get the right position.

In terms of orientation, like Job wrote, you can use setWPR(), manipulate the NOA vectors for aligning the XYZ axes of the matrix, and even use arbitrary axis (V) to rotate the matrix as needed. But the multiplication stuff is often all I need to do to get the solution.

But of course, we can go loco and try this.

from vcScript import *
import vcMatrix

m =
wpm = getComponent().World.PositionMatrix #gets world root node position
m = m * wpm

#new matrix should be at world origin
print m.P.X, m.P.Y, m.P.Z


Thanks to you two!

Will try this when i get back to the office and report my success (hopefully)!