Hi Everyone,
I just wonder if anyone come across this idea before, due to my work I have to keep rotate and line up views in sheet. is it anyway we can rotate selected view with Dynamo? The rotate on sheet of Revit is very poor command, I usually have activate every single views then select crop view visible then rotate it. Is there any node or routine to allow rotate selected views?
Thanks for reading
Once you place a view on a sheet, it becomes a viewport element. Those have a location property that we can access through the API. Here’s a little example, I decided to dust off my UI nodes for it:
Hi Venkov,
I try your routine but this is same the the option rotate view on sheet of revit. it rotate the whole view including anotation…
Any chance, we just rotate the crop view only, thanks
If you want finer grained control, then I suggest you use Scope boxes as Andrew suggested. You’ll find examples on how to select and apply them if you search the forum.
It should be possible to rotate a view’s crop region directly with the API’s “ElementTransformUtils.RotateElement” method but I wouldn’t recommend it.
Now the trick of course is to get the proper angle to rotate the view by, because I am guessing that you are looking to align it with some element in view (wall, grid etc.). To get view crop box I was using a little trick that Jeremy Tammik shared on his blog:
What happens here is that you turn off the crop box, select everything in view, then create exclusion filter for all these elements, then turn the crop box back on and select everything but previously selected things. This should leave you with the only new thing visible in view: CROP BOX.
I wouldn’t really recommend it because in my humble view it’s bad BIM
Once somebody rotates a view by an odd angle (i.e.12.4130245212 degrees) and forgets to document the change anywhere, there’s no quick way to rotate it back to its original position. Even worse, if you do attempt to shift it back manually and eff up the n-th digit (or a floating point number does its things and muddies things for you), your model accuracy will suffer and you might expose yourself to numerous annoying line misalignment warnings and other errors.
That’s why it’s better to use scope boxes (or the True North view setting) because you can quickly and safely go back to the view’s original state and continue modeling as usual.
This is great code and there’s definitely some isolated cases where you have no other choice but to modify the crop box but I’d only resort to that if I don’t have any other alternatives.
For the 180degrees rotation of multiple sections I have tried to use the code you supplied, however I am unable to get it to work. So I have a few questions; Of what type are the 3 inputs (view, cropbox, angle)? And why am I getting this error?
Warning: Cannot find static method or constructor Autodesk.DesignScript.Geometry.Line.Createbound()
I used the code in a code block(had to make a few syntax changes), is that the right way?