ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Canceling an AutoCAD command using an ARX function.

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
bakerrl2
1371 Views, 4 Replies

Canceling an AutoCAD command using an ARX function.

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;

}

 

4 REPLIES 4
Message 2 of 5
owenwengerd
in reply to: bakerrl2

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.

--
Owen Wengerd
ManuSoft
Message 3 of 5
bakerrl2
in reply to: owenwengerd

I may have wrote it as an ARX - AutoLisp function originally because I thought I might call it from other ARX programs; however, after checking it appears that it is only being called from AutoLisp programs so I could convert it.

Still even after I converted the code to AutoLisp it still did not cancel the current command. I haven't figure out why yet.

Richard L. Baker II
Svc Info Developer III
ES Apps Development US
richard.baker-ii@hp.com
T +1 512 319 3637
HP Enterprise Services
[cid:image003.png@01CF9130.81CB5D40]

Please print thoughtfully
Message 4 of 5
bakerrl2
in reply to: bakerrl2

After a little more experimentation I was able to convert the ARX function to AutoLisp and get it to work.

Message 5 of 5
27925916
in reply to: bakerrl2

how to cancel an active AutoCAD command in CAD 2015 above?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost