Thanks, but it does cancel the current command, the problem is that it doesn't fire the CommandCancelled event, and doc.CommandInProgress is always blank if I'm waiting on Editor.GetPoint from the user.
So I'm not able to put my code for the new command in doc.CommandCancelled, and since
doc.SendStringToExecute is asynchronous that means that the code for my new block is fired before the cancel is called which cancels out of the Editor.GetPoint for the new block as well, I just want to cancel out for the old block.
So I need a way to have doc.SendStringToExecute("\x03\x03", false, true, false) fire my doc.CommandCancelled event when using Editor.GetPoint prompt or a different way to send the cancel command synchronously. Most of the options I've seen posted are older and I can't get working in 2016+ AutoCAD.
The palette is always showing, this is the full process:
1) User clicks on a button on the palette. Should cancel out of any current command before continuing with code. This works for commands like LINE if they are running and calls the CommandCancelled event, but doesn't work when it's one of my own Prompts waiting.
2) Code grabs information for the corresponding block
3) Prompt user for the insertion point of the block
4) Loop until cancelled -> If user cancels themselves there is no issue.
5) User clicks on new button -> Needs to cancel out of last command before running new code.
6) Repeat.
It looks like Editor.Command() sends synchronously but I can't find what to send it for cancel.