Rotate scope box parallel to line

Hello,
I have a project where the scope boxes are ever so slightly in a different angle than the grids. This is a result of a bad cad file we used early in the project, the angles were zero for the first two decimal only and we didnt notice as we are using angle dimensions with 2 decimals. Now I want to fix this to rotate the scope boxes by the amount they are rotated compared to the grids. So grids are the reference.

My problem is I cannot find a way to match rotation. I have more clear explanation on the images attached.

scopeboxtest.dyn (29.3 KB)

Try Vector.XAxis or Vector.YAxis as input for Vector.AngleWithVector.
Element.SetRotation operates with units degrees, as far as i know.

Hi,

As suggested you could use XAxis vector and get the rotation,
It just seems to be tricky in the end to rotate in a positive direction or negative.

It seems to solve 80% of the cases but there is something that I missed, it doesn’t work for all angles.
Hope this helps.

There is some weirdness here. So I have tried your flow and it is again just rotates the scope box in an arbitrary angle in revit that I don’t understand.
Then I have tried this one: when I rotate a piece of wall the element.setrotation works as expected, you set a value and the element will be rotated in that angle. But when I do the same with a scope box it just spins wherever. I don’t understand the correlation between the input number and the rotation I can see on the screen.
rotate

Now I see the mistake with min and max :smile:

Please try this.
If it doesn’t work I think you have an issue with units.

1 Like

worked.

thank you

One more thing that was missed and could cause a problem.

image

Just place x<0 instead of x<1, I don’t know why I placed 1 :smile: