Thanks for your reply Jeremy,
Well what confused me was that even if the transformation is wrong, it should be wrong every time right ? it seems really odd to me that setting the box to the exact same object 3 times yields different results. I'm calculating the transformation like this:
double alpha = Math.Atan2(end.Y - start.Y, end.X - start.X);
//some adjustments to alpha based on the elevation direction;
Transform rotation = Transform.CreateRotationAtPoint(XYZ.BasisY, alpha, midpoint);
The angle should be in radians, I said 30.0 degrees just as an example but I'm not passing plain degrees to revit.
I attached two images, one is how the object is rotated if I set the rotation once, and the other one if i set the rotation (to the exact same transformed BoundingBox) 3 times.
By the way, is not for all cases that repeated rotations are different. For some angles, it's rotated completely the first time, for some others it takes 2 rotations, and for some others 3.
I'll use the transformation on model lines as you suggest to see if it behaves as expected as you suggest.
set rotation 3 times
set rotation 1 time
Thanks again!