Hello Dynamo Cummunity
I have 2 identical PlanViews on a sheet, view left has been rotatet.
I would like to rotate view right by the same angle that view left has been rotatet.
After searching the forum i found a python script for rotating views.
Hi Vo,
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:
[image]
Here’s the code. Once you ignore the default inputs it’s pretty simple:
import clr
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
c…
It does work, but i don´t understand the input number. For example, if i use input “3” the view will rotate 180°.
I also have no idea how i can get the rotation angle of a view.
So i ask for your help and would be really happy about any advice!
Thank you!
Hi @gerhard.p ,
As explained in the post you linked, the difficulty isn’t to rotate the cropbox of a view but to get the rotation of the another view.
Good luck !
Thanks Alban,
So i have to find a workaround to get the rotation angle, in my example that would be to get the “rotation” of the Column.
And then i have to figure out how to set a specific angle to a view.
I´m going to try that in the evening
So it’s possible to retrieve the rotation of the CropBox and set the rotation of another CropBox.
At the same time, I added the section markers and Sectionboxes to my custom node.
4 Likes
Amazing! Looking forward to test it tomorrow and i will post my experiences!
Thank you Alban
Hello Alban,
I did a few tests and it is working fine, thank you so much for your help!
With view.GetCropRegion.Element from Rhythm i should be able to get this to work in one of my scripts!
After more testing i found a problem. The problem is that i don´t get the rotation of a view, what i would like. I get the angle of the cropbox.
Here i have 2 examples of views that have not been rotatet , they have the original orientation of the Project.
In example one i get 0° rotation, nice.
In example two, instead of 0° i get 64.51
and this leads to the following result when i create a new Planview and try to set the same rotation to it:
What does work perfect is if the view has a rotation :
This view has a rotation and it is applied correctly to another view.
So the problem case is if a view has no rotation, but the cropbox is not horizontal…it seems…
I just figured out what the Problem is.
Before you can read out the Rotation Angle of a view you have to use the function Reset Crop!
Now i just have to find out how to do that in dynamo.
Here you can see a View without a rotation that gives me a “false” rotation. After resetting crop i get 0° and thats what i want.