Rotation origin is inaccurate/shifted

Hello I have this script to read the vector of two objects (Pipe and pipe hanger)

in order to align the hanger with the pipe the rotation angle of the hanger must equal to the rotation angle of the two vectors

however when inputting that angle which is 24 in the FamilyInstance.SetRotation node the angle shift is slightly off

image

comparison between manually editing the angle and the SetRotation node result

image

Thanks in advance

Hi is vector angle about axis better ?
Revit_y4hnkzLOx1

24.000000000003 degrees is 24 degrees.

This is a floating point error, and likely not something you need to account for.

Your pipes will be installed in hangers which are off by more than that value. In fact, as a test try and draw that 0.000003 degree angle, and get the rise over 100 units - the difference on the X axis is something like 0.00005 units. If you are in meters that is 0.05 mm, something you wouldn’t be able to measure. and that is with a 100 meter long pipe no less.

If you are really worried about it, there are a few things you can try:

  1. Normalize the vectors before you take the angle comparison.
  2. Rotate the object twice.
  3. Utilize the RevitAPI’s ElementTransform tools to set the rotation and apply an alignment when done to confirm they are the same.
1 Like