How to "Escape" a running Command (i.e. BooleanUnion)

I am trying to find a way to interrupt a long running process in Rhino, such as a BooleanUnion of a lot of objects.

My only current solution is to using Windows API or SendKeys to send the ESCAPE key or the “!” to Rhino.

Is there a better way to abort a running Rhino Command using RhinoCommon?

I’m currently doing this to abort a command:

Hi Jason,

That’s probably as good of a way as any. There is no programatic way to know of a cancelable, time-consuming task is running. And there isn’t any programatic way of canceling one, even if you did know there was one running.

– Dale

I had hoped that you would exposed the Background Worker or Cancellation
Token or Task object’s “Cancel” mechanism. But this is working for now.
Thank you.