Extracting quaternion information from Maya with python?

Hi. I have a question about extracting quaternion information from Maya with Python. I’m studying rotation matrix maths right now and wrote some code to do simple quaternion arithmetic. I wanted to test out my code to see if it’s doing the right thing and I figured I could run simple tests with Maya to see if the results I get from my code tallies with Maya’s values.

But I’m getting stymied because there doesn’t seem to be a straightforward way to extract quaternion values with Python. Maybe with Maya’s open API I could, but I don’t really know how to code Maya API.

Is there some way to extract the information without digging all the way down to the API level? I admit I’m pretty confused with the xform command as well wrt the matrix information it’s pulling out. Any help at all would be appreciated.

Regards,
XJ

You could use a decomposeMatrix node to get the information you are looking for.

Hey, thanks. I tried it out and it seems to spit something out. I will test my code with this during the weekends.

Appreciate the tips man.