Angle from Transform Matrix returns wrong value for assemblies

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am using a matrix calculation ( angle = acos ((basisX.x + basisY.Y + basisZ.Z -1)/2) ) to return the rotation angle of assemblies. I have been using this for a couple of months without any problems. However a few assemblies seem to return a wrong value in my last project.
Using the post 'Get Angle from Transform.BasisX, BasisY and BasisZ' (https://forums.autodesk.com/t5/revit-api-forum/get-angle-from-transform-basisx-basisy-and-basisz/td-...) I have also calculated the angle.
In my example assembly 'WA045' returns the same values for both calculations (this assembly has a correct rotation). However assembly 'WA014' returns two different values of which '204 degrees (or 24; anything at a 90 deg angle from 114 deg)' seems to be correct, but the value of '156 deg' from the matrix calculation is wrong.
Is my approach faulty or am I missing something?
regards,
Raymond