Pause for User Input

AutoCAD ActiveX

 
Pause for User Input
 
 
 

Sometimes it is useful to accept input from the keyboard or the pointing device in the midst of a macro by placing a backslash (\) at the point where you want input.

circle \1
layer off \;

The first macro pauses to ask the user for the center point and then reads a radius of 1 from the macro. Note that there is no space after the backslash character (\). The next macro pauses to ask the user to enter one layer name, then turns that layer off and exits the LAYER command. The LAYER command normally prompts for another operation and exits only if you press SPACEBAR (blank) or ENTER (;).

Normally, the macro resumes after one item is entered. Therefore, it isn't possible to construct a macro that accepts a variable number of inputs (as in object selection) and then continues. However, an exception is made for the SELECT command; a backslash suspends the macro until object selection has completed. For example, consider the following macro:

select \change previous ;properties color red ;

This macro uses the SELECT command to create a selection set of one or more objects. It then issues the CHANGE command, references this selection set using the Previous option, and changes the color of all selected objects to red.

Because the backslash character (\) causes a macro to pause for user input, you cannot use a backslash for any other purpose in a macro. When specifying file directory paths, use a forward slash (/) as the path delimiter: for example, /direct/file.

The following circumstances delay resumption of a macro:

  • If input of a point is expected, Object Snap modes may precede entry of the actual point.
  • If X/Y/Z point filters are used, the macro remains suspended until the entire point has been accumulated.
  • For the SELECT command only, the macro doesn't resume until object selection has been completed.
  • If the user responds with a transparent command, the suspended macro remains suspended until the transparent command is completed and the originally requested input is received.
  • If the user responds by choosing another macro (to supply options or to execute a transparent command), the original macro is suspended, and the newly selected item is processed to completion before the suspended macro is resumed.