KennanChan / Revit.Async

Use task-based asynchronous pattern (TAP) to run Revit API code from any execution context.
MIT License
223 stars 51 forks source link

IExternalApplication Implementation #18

Closed RyanPatrickDaley closed 1 year ago

RyanPatrickDaley commented 1 year ago

I'm not getting Revit.Async to work, and I think it might be because I am trying to implement it within an IExternalApplication instead of an IExternalCommand. I tried to start a simple method within RevitTask.RunAsync(), and it never finishes running. So in this sample method, I never reach the second line of code:

private async void SelectInRevit()
{
 await RevitTask.RunAsync(
      UIApp =>
      {
          UIApp.ActiveUIDocument.Selection.SetElementIds(SelectedFam.ElementIds);
      });
SelectionChangeable = !SelectionChangeable; 
}
KennanChan commented 1 year ago

Have you initialized RevitTask in the entry of your application or command?

RevitTask.Initialize(app);
RyanPatrickDaley commented 1 year ago

Yea, that was in fact the problem. Now it is working!