Changing active view is temporarily disabled?

Do you mean refresh or set the view? If all you need to do is refresh the active view use UIDocument.RefreshActiveView.

RequestViewChange is used for external applications (i.e. Dynamo) to active a view. It’s asynchronous, which means it doesn’t execute in sequence; instead it waits for control to return to Revit and then the view is set. This therefore can only occur after Dynamo has completed its own process, and therein lies the problem; if you attempt to use this method as one of a number of steps in a Python script, whereby subsequent steps are dependent on the active view being set, the program will fail as control is still with Dynamo (i.e. the view wont be set yet).

An example of this limitation is deleting views. Say there are two views, A and B. B needs to be deleted. Its also the current active view. Active views cant be deleted, so A needs to be set as the active view first. We write a python script which calls the RequestViewChange to set A as the active view. In the next line of our code, we attempt to delete view B. As Dynamo has control as its busy executing the Python script, view A cant be made active, so the process will fail.

1 Like