General Access

The most general of the functions that access AutoCAD are acedCommandS()/acedCommandC and acedCmdS()/acedCmdC(). Like the (command) function in AutoLISP, these functions send commands and other input directly to the AutoCAD Command prompt.

int acedCommandS(int rtype, ...);

int acedCmdS(const resbuf* rb, bool forFutureUse = false, AcApDocument* pForFutureUse = NULL);

Unlike most other AutoCAD interaction functions, acedCommandS() has a variable-length argument list: arguments to acedCommandS() are treated as pairs except for RTLE and RTLB, which are needed to pass a pick point. The first of each argument pair identifies the result type of the argument that follows, and the second contains the actual data. The final argument in the list is a single argument whose value is either 0 or RTNONE. Typically, the first argument to acedCommandS() is the type code RTSTR, and the second data argument is a string that is the name of the command to invoke. Succeeding argument pairs specify options or data that the specified command requires. The type codes in the acedCommandS() argument list are result types.

The data arguments must correspond to the data types and values expected by that command's prompt sequence. These can be strings, real values, integers, points, entity names, or selection set names. Data such as angles, distances, and points can be passed either as strings (as the user might enter them) or as the values themselves (that is, as integer, real, or point values). An empty string (“”) is equivalent to entering a space on the keyboard.

Because of the type identifiers, the acedCommandS() argument list is not the same as the argument list for the AutoLISP ® (command) routine. Be aware of this if you convert an AutoLISP routine into an ObjectARX ® application.

There are restrictions on the commands that acedCommandS() can invoke, which are comparable to the restrictions on the AutoLISP (command) function.

Note: The acedCommandS() and acedCmdS() functions can invoke the AutoCAD SAVE or SAVEAS command. When they do so, AutoLISP issues a kSaveMsg message to all other ObjectARX applications currently loaded, but not to the application that invoked SAVE. The comparable code is sent when these functions invoke NEW, OPEN, END, or QUIT from an application.