Create a Custom Command

User can create custom command in DraftSight using basic DraftSight syntaxes. For this user do not have to be a programmer. But user should be aware of basic macro syntax to create custom commands. These commands can be used from toolbar and pull down menus.

You can easily create custom command for; command, command sequence or command option that is used again and again.

To explain this in detail, I have created an example of custom command string to create multiple circles. This command will cancel any running command and execute circle command. This will draw two circles with different radii. This command will ask user to specify centre point of circle in graphics area.

 Command string: ^C^C_circle \\4;circle \\2

You will notice that the command expression starts with ^C^C. Each ^C is equivalent to hitting Escape key. So every command string should start with ^C^C to ensure that running command is cancelled when invoking the command or command sequence.

The next code in the expression is backslash (\\) which is used to pause for user inputs, such as picking a point or entering a value.

Next syntax you will see in the expression is a semicolon (;) which is equivalent to pressing Enter.

 

Here is the basic syntax list that is required to create custom command:

 

^C                       - Is same as hitting Escape from keyboard.

;                          - Is equivalent to pressing Enter.

\\                          -Pauses the macro for user inputs.

Blank space     -A blank space between command sequences in a macro is equivalent to pressing the Spacebar key.

^P                       - To toggle the SETMNUECHO mode on or off

 

To create a new command:

  1. Enter Customize command in the Command Window or go to Tools > Customize Interface..
  2. In the Customize dialog box, in the commands list, click Add Command
  3. In the Name filed enter your command name
  4. For Command string, type a command, command sequence, or command option
  5. Click Show icon explorer to show the icon explorer
  6. From the Icon Explorer drag a small icon and a large icon to the corresponding Small and Large fields of the new command entry. These icons are used for menus and toolbars. The location and file name of the icons displays in Small icon location and Large icon location.
  7. For Description, type a description to display in the status line when you move the pointer over the corresponding command in a menu or toolbar.
  8. Click OK


To Crete a toolbar or menu bar entry:

  1. In the Customize dialog box, expand a menu or toolbar
  2. Navigate to the location in the menu or toolbar (you can create your menu or toolbar) where you want to place the new item.
  3. Click Show command explorer to expand the Command Explorer
  4. In Command Explorer, select a new command entry and drag it to the menu or toolbar
  5. Click OK


6. And try out your custom command