If you find yourself using the same combination of commands and options over and over, you can easily create a custom command that executes the combination with a click of a button or a menu item. In this tutorial, I explain the basics of AutoCAD’s menu syntax so that you can create your own commands. No programming required!
- Enter cui at the command line/dynamic tooltip to open the Customize User Interface dialog box.
- In the Command List pane, click New (Create a New Command).
- In the Properties pane, enter a name for the command in the Name text box. Also enter a description in the Description text box.
- If you think your command will be long or need more than one line, click in the Macro text box and then click the Ellipsis button that appears on the right. Then enter your macro in the Long String Editor dialog box. Otherwise, enter the macro in the Macro text box. Start by writing out the combination of commands and options as you would enter them on the command line or in a script. Then add any necessary special characters.
Below are the special characters you need to know for menu macros:
|Space||Equivalent to pressing Enter except when entering text to create a text object that contains spaces (between words). Use between the command and its options.|
|; (semi-colon)||Equivalent to pressing Enter. The end of a line in a menu macro is also equivalent to pressing Enter. More helpful than using a space when you need to press Enter twice, because it shows the number of Enters more clearly. Also helpful at the end of the macro.|
|\||Pauses for user input, such as picking a point or entering a value.|
|+||At the end of a macro line, continues the macro to the next line|
|*||At the beginning of a macro, before ^C^C, repeats the macro until you press Esc or choose another menu item.|
|^P||Toggles the display of the menu macro on the command line; makes the macro look neater when you use it.|
- From the Command List Categories drop-down list, choose Custom Commands to easily find your command. Select it and drag it to the desired menu or toolbar at the top of the Customize User Interface dialog box.
- If you drag it to a toolbar, use the Button Editor to give it an image. Usually, you choose an existing button to start with, click Edit, and modify it. Then click the Save As button to save the icon image.
- Click OK and try out your new command!