However, if I apply âUndoâ in Revit, and run the Dynamo Python node again, the rotation is performed for 90 degrees (even though I still have 45 degrees defined in the code). Why is this happening?
I identified that this problem appears only when I am using Dynamoâs âRevitServices.Transactions.TransactionManagerâ. If I use Revitâs âAutodesk.Revit.DB.Transactionâ, the column is correctly rotated by 45 degrees, each time I run the Dynamo Python node.
Does anyone have an explanation, why is âRevitServices.Transactions.TransactionManagerâ buggy in this situation?
According to posts on this forum, there is no reason not to use Dynamo TransactionManager, it is actually advised to use it instead of Revit one.
Any help is appreciated. I am using Revit 2019.2 and Dynamo 2.0.2
I am trying to use Revit API to rotate the structural column. I see you used Revit Nodes.
As for @sovitek 's advice: I get False when checking the property of the structural column family instance:
# el
el = UnwrapElement(IN[0])
OUT = el.CanRotate # returns 'False'
It guess it has to be a bug with the Dynamo âRevitServices.Transactions.TransactionManagerâ namespace?
@george change the Column Style parameter to anything other than Vertical, then change the Cross-Section Rotation value to any angle value you want, I am sure these parameters are accessible through the API.
I tried changing the âColumn Styleâ parameter to both Slanted - Angle Driven and Slanted - End Point Driven:
but in both cases I get âFalseâ on the OUT = el.CanRotate.
Even if I got âTrueâ, under the âFamilyInstanceâ class I see only one method ârotateâ, and it only rotates by 180 degrees, it has no input for the rotation angle.
So the correct Revit API way to do it has to be through Autodesk.Revit.DB.ElementTransformUtils.RotateElement, I just donât understand why Dynamo TransactionManager fails. And even so it makes uneasy if I should ever use the TransactionManager again for other transactions.
If you move the Python into a custom node, does that resolve the undo issue?
If you use the out of the box nodes instead of Python does that resolve the undo issue?
If you use Python 3 (in Revit 2022) does that resolve the undo issue?
If you set the parameter for cross section rotation instead of rotating the element, does that resolve the undo issue?
If you update to the lastest version of Revit (2019.2.4) and Dynamo for Revit 2019 (2.0.4), does that resolve the undo issue? Note that Revit 2019 will no longer be supported in a few months, so itâs time to upgrade anyway.
If you run via Dynamo Player, does that resolve the undo issue?
If you undo twice instead of once, does that resolve the undo issue?
3 ) I have just tested the code on Revit 2022 and Dynamo 2.10.1 and IronPython2 (not CPython). There are no problems at all. So the bug must have been in Dynamo 2.0.2 for Revit 2019.
The reason why I still stick with 2019, is because our current project is using this version (the architect client sends the .rvt file in 2019 format), so I have everything setup (custom Dynamo node packages also) on Revit 2019. But I agree with your advice, I should start working in 2022.
1 ) I havenât tried this.
2 ) Itâs hard to compare. RevitNodes âFamilyInstance.SetRotationâ does not allow a âcumulative rotationâ, which what I am after. By cumulative, I mean: it will not rotate the column by 45 degrees more, if rotation angle input remains 45. Literally it will not perfom rotation at all, it will stay the same.
But yes, there are no issues with Undo when it comes to âFamilyInstance.SetRotationâ node.
4 ) The structural column in question does not have the âCross-Section Rotationâ parameter.
5 ) I didnât try this.
6 ) Didnât try it.
7 ) Didnât try it.
The screenshot above indicates that parameter exists as an instance parameter, so I made an assumption. Itâs likely best to post a sample RVT and the full DYN, otherwise weâre stuck guessing.
If youâre using âadditiveâ 45, than this result would make sense as youâre creating the same instance a second time, so Dynamoâs seeing it as the same thing, the rotation would report as 45 as that was what it was before, and then itâll add another 45 to that. If you use 10 degrees does the rotation wind up at 20 degrees?
Best to flag this as needing an upgrade now then - youâre clearly in the Design phase which means that there is ZERO chance of completing the project before the end of support.
One can download the .rvt and .dyn files in the first reply of the topic.
And you are right, thereâs âCross-Section Rotationâ parameter. I just had to switch âColumn Styleâ parameter to either Slanted - Angle Driven orSlanted - End Point Driven. When itâs at `Verticalâ, only then the âCross-Section Rotationâ parameter does not exist.
And you were right - I could also rotate the column by changing this âCross-Section Rotationâ parameter, itâs just it does not support cumulative rotation.
It should work cumulative - this is what I need. If I use something less than 45 (like 20 or 22.5), then it also works cumulative. The bug was definitely with Dynamo 2.0.2.
I think the reason why the architect is still with Revit 2019 is because they have some plugin made for that version. An external CAD office made it for them, and they would have to pay again if they would like to use it on Revit 2022. At least thatâs the information I got, donât know if this is the reason.