Hi I am trying to change the active view via the python node in dynamo (1.2) . Currently I get the following error after initializing. It seems that the ui has a limitation, perhaps this is dynamo specific error?
************* Exception Text ************** Autodesk.Revit.Exceptions.InvalidOperationException: Setting active view is temporarily disabled. at Autodesk.Revit.DB.Document.CheckLimitations(APILimitations limitations, String action) at Autodesk.Revit.UI.UIDocument.set_ActiveView(View view)
My code (a snippet of it) looks something like below where view will be a view object. As you can see im using transaction manager to try to close open transactions, as mentioned somewhere, but to no avail.
# Import DocumentManager clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument uiapp = DocumentManager.Instance.CurrentUIApplication uidoc = uiapp.ActiveUIDocument app = uiapp.Application view = uidoc.ActiveView def setActiveView(view): global doc TransactionManager.Instance.ForceCloseTransaction() uidoc.ActiveView = view TransactionManager.Instance.EnsureInTransaction(doc) TransactionManager.Instance.TransactionTaskDone()