Macro Termination

AutoCAD ActiveX

 
Macro Termination
 
 
 

When a macro is executed, AutoCAD places a space at the end of the macro before processing the command sequence. AutoCAD processes the following menu macro as though you had entered line SPACEBAR.

line

Sometimes this is undesirable; for example, the TEXT or DIM command must be terminated by ENTER, not by a space. Also, it sometimes takes more than one space (or ENTER) to complete a command, but some text editors don't let you create a line with trailing blanks. Two special conventions get around these problems.

  • When a semicolon (;) appears in a macro, AutoCAD substitutes an ENTER.
  • If a line ends with a control character, a backslash (\), a plus sign (+), or a semicolon (;), AutoCAD does not add a blank after it.

Look at the following macro:

erase \;

If this item simply ended with the backslash (which indicates user input), it would fail to complete the ERASE operation, because AutoCAD doesn't add a blank after the backslash. Therefore, this macro uses a semicolon (;) to force an ENTER after the user input. Here are more examples:

ucs 
ucs ; 
text \.4 0 DRAFT Inc;;;Main St.;;;City, State;

Selecting the first macro enters ucs and SPACEBAR on the command line, and the following prompt appears:

Enter an option [New/Move/orthoGraphic/Prev/Restore/Save/Del/Apply/?/World] <World>:

Selecting the second macro enters ucs, SPACEBAR, and semicolon (;) at the command line, which accepts the default value, World. No difference between the first and second item would be evident on the screen; naturally, you wouldn't put both on the same menu.

Selecting the third macro displays a prompt for a starting point and then draws the address on three lines. In the triple-semicolon (;;;), the first semicolon ends the text string, the second causes repetition of the TEXT command, and the third calls for the default placement below the previous line.

NoteAll special characters must be input using their ASCII equivalents. For a list of ASCII equivalents, see Macro Characters Mapped to ASCII Equivalents.