Matching an Existing Assembly View Rotation

I created a script to replicate an existing assembly’s sheets and views. In a nutshell, it will take the sheet(s), the view(s) that are placed on the sheet(s) and the location(s) of each view, of a selected assembly and create the same for another assembly. The issue I am having is if the original views have been manually rotated by rotating the crop region, I can’t figure out how to get the rotation angle of those and apply that rotation angle to the newly created views for the second assembly. The script is too large to clip the entire graph, because it has a great deal of custom nodes with large graphs embedded. But the part that creates the new views and places them on the sheets is shown below.


Any direction and help would be greatly appreciated!
Thanks

Still looking for guidance on this, if anyone can help!

Hi @staylor,
See if this points you in the right direction.

Cropbox Rotation.dyn (32.8 KB)

Hey @AmolShah,
The problem is that I am dealing with Assembly views. Either Top, Back, Left, Right, etc., and I can’t rely on the view names, because my company uses third party software which requires them to change the assembly origin, which in turn changes the assembly’s orientation. And not everyone uses this method. Therefore, the vector to check against the line direction and the rotation axis won’t always be the same. I am using the RevitLookup utility and was wondering if getting the transform of the bounding box of the view’s cropbox and somehow apply that to the other view’s cropbox would work. I don’t know how to get a bounding box of a cropbox and not sure if that is even the right direction to follow.

Thank you,

I pretty much have a work around. It’s not exactly as I wanted as it relies on the user setting the origin the same for each assembly.

I take the updirection of the source view and get the axis that it’s parallel to. Then I use that as the axis to compare the updirection of the destination view to. Whatever the angle is returned, that is how much that view needs to be rotated. The view direction is the rotation axis. So again, as long as the origin of each assembly is oriented exactly the same, it works.

Thanks again @AmolShah for your response.

1 Like

One thing to add. For the source view, you will also need to perform an angle check between that views updirection and the axis that it’s parallel to, to make sure that view hasn’t been rotated 180 degrees. If so, you will need to subtract that out as well.