Cancel AutoCAD commands programmatically using ObjectARX

By Xiaodong Liang

Issue
How do I cancel out of a currently running AutoCAD command, such as MOVE. I would do some handling in an editor reactor's commandWillStart function, and in some cases, cancel the regular AutoCAD MOVE function.

Solution
The AcEdCommandStack stores pointers to ARX objects and functions, but there is no access to the function pointers of native AutoCAD commands. However, you can perform a cancellation in an editor reactor callback.

extern Adesk::Boolean acedPostCommand(const char* ); 
void MyEditorReactor::commandWillStart(const char * pCmdStr) 
{
   if ( strcmp(pCmdStr,"MOVE" ) == 0  )
    acedPostCommand("CANCELCMD");  
}

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading