C:XXX Functions

AutoCAD AutoLISP & Visual LISP

 
C:XXX Functions
 
 
 

If an AutoLISP function is defined with a name of the form C:xxx, it can be issued at the AutoCAD Command prompt in the same manner as a built-in AutoCAD command. This is true regardless of whether you define and load the function in VLISP or at the AutoCAD Command prompt. You can use this feature to add new commands to AutoCAD or to redefine existing commands.

To use functions as AutoCAD commands, be sure they adhere to the following rules:

  • The function name must use the form C:XXX (upper- or lowercase characters). The C: portion of the name must always be present; the XXX portion is a command name of your choice. C:XXX functions can be used to override built-in AutoCAD commands. (See Redefining AutoCAD Commands.)
  • The function must be defined with no arguments. However, local variables are permitted and it is a good programming practice to use them.

A function defined in this manner can be issued transparently from within any prompt of any built-in AutoCAD command, provided the function issued transparently does not call the command function. (This is the AutoLISP function you use to issue AutoCAD commands; see the entry on command in the AutoLISP Reference.) When issuing a C:XXX defined command transparently, you must precede the XXX portion with a single quotation mark (').

You can issue a built-in command transparently while a C:XXX command is active by preceding it with a single quotation mark ('), as you would with all commands that are issued transparently. However, you cannot issue a C:XXXcommand transparently while a C:XXX command is active.

NoteWhen calling a function defined as a command from the code of another AutoLISP function, you must use the whole name, including the parentheses; for example, (C:HELLO). You also must use the whole name and the parentheses when you invoke the function from the VLISP Console prompt.