DynamoDS / DynamoRevit

Dynamo Libraries for Revit
https://dynamobim.org
338 stars 188 forks source link

Periodic Updating interrupts and terminates user actions in Revit #1762

Open ThomasMahon opened 7 years ago

ThomasMahon commented 7 years ago

Dynamo version

1.3.1

Revit version

Revit 2017

Operating system

Win 10

What did you do?

Enabled periodic updating with one of my ZT nodes.

What did you expect to see?

Re-execution of Dynamo at the time interval set to trigger the update.

What did you see instead?

It all works as expected with one catch - if the user is performing an action within Revit and the periodic update triggers during this event, the action is interrupted and terminated without warning.

For example, if the user is entering text in a field within Revit and the periodic update triggers, they will lose whatever they were typing - it appears that the update force-cancels any active operation occurring in Revit. To a certain extent, this behaviour would be expected given that control has to be handed to Dynamo for it to execute, but its clearly a workflow problem in situations where the user might want feedback between changes made in Revit and representations of those changes in Dynamo.

Periodic Updating Problem.zip

dimven commented 7 years ago

If you're doing anything reactive that has to deal with revit, then it's probably smarter to tie directly to Revit's events. The document.Changed might be a good option. You can check some of the view model nodes as an example:

https://github.com/DynamoDS/DynamoRevit/blob/7270187e8688fbd8ec538b4617810dccdb9a695f/src/DynamoRevit/ViewModel/DynamoRevitViewModel.cs

ThomasMahon commented 7 years ago

Good suggestion - ideally though I want to avoid having to separate the nodes affected by this issue into another project as the project they're currently in includes many other nodes (as ZT can't be mixed with MVVM nodes).