Closed yafimski closed 1 year ago
Well, it is a matter of wrapping an external process with task-based asynchronous pattern. The wrapper wraps around Process object just like Revit.Async wraps around Revit ExternalEvent
https://github.com/Cysharp/ProcessX This is a package I found on github who does similar wrapping
And your last part is right. When an external console app finishes running, you may get the result in a background thread. And you can then use Revit,Async to commit transaction on site easily
And your last part is right. When an external console app finishes running, you may get the result in a background thread. And you can then use Revit,Async to commit transaction on site easily
Can this be done with the regular Revit.Async example, or do I need to use the example below Define your own handler in the readme? I just don't see where the 'process' comes in, for the vanilla example..
It's not part of Revit.Async, nor it is part of Revit.
You need to find solutions in the .NET world.
Actually the Microsoft .NET docs about System.Diagnostics.Process.Exited event demonstrates a simple async/await wrapper around Process object.
The key is to use TaskCompletionSource<T>
class. It generates a Task<T>
object for other logic to wait. And use TrySetResult<T>(T result)
to signal that the Task<T>
completes and other logic is can run.
Weakly related to Revit.Async, I think I can close this issue
Hi, I think this repo can be useful to execute a Console App from Revit, because the console app has async code, so I want to await the result of the console app before I trigger any
ExternalEvent
from Revit.I'm new to this, so perhaps there is a simple way to explain how to: Start Revit
Command
-> StartConsole App
->Await Result
-> useResult
inExternalEvent
-> doTransaction()
any tips on how to achieve this?