In ObjectARX 2010 and earlier we could cancel an active AutoCAD command by calling acedCommand(0). In ObjectARX 2015 I tried using acedCommandS(0); however, it does not seem to do anything.
Here is the function we call from our AutoLisp routines to cancel any active commands when an error occurs. This defines as an AutoLisp function in the ARX program. In addition, the BVExtVar class is used to get system variables from AutoCAD. As you can see the function loops calling acedCommandS(0) until no commands are active. This function works fine in ObjectARX 2010. In ObjectARX 2015 it goes into an infinite loop because the command never gets canceled.
Note: I need to be able to cancel a command immediately because I may need to execute other commands after the error has occurred.
int CancelCommand()
{
short cmdActive;
BVExtVar sysvar;
if (sysvar.getvar(_T("CMDACTIVE"), &cmdActive) == RTERROR)
cmdActive = 0;
while ((cmdActive & 1) == 1)
{
acedCommandS(0);
if (sysvar.getvar(_T("CMDACTIVE"), &cmdActive) == RTERROR)
cmdActive = 0;
}
acedRetVoid();
returnRSRSLT;
}
Solved! Go to Solution.
Solved by bakerrl2. Go to Solution.
Wouldn't it make more sense to do this command cancelling from AutoLISP directly instead of calling into ObjectARX code? You may still have the same problem, but at least it should be less complicated to solve if you're not also dealing with a context switch at the same time.