2012
Table Of Contents
- Contents
- Basic Customization
- Custom Linetypes
- Custom Hatch Patterns
- User Interface Customization
- DIESEL
- Command Scripts
- Introduction to Programming Interfaces
- Shapes and Shape Fonts
- Overview of Shape Files
- Create Shape Definition Files
- Shape Descriptions
- Vector Length and Direction Code
- Special Codes
- Use Special Codes
- Codes 0, 1, and 2: End of Shape and Draw Mode Control
- Codes 3 and 4: Size Control
- Codes 5 and 6: Location Save/Restore
- Code 7: Subshape
- Codes 8 and 9: X-Y Displacements
- Code 00A: Octant Arc
- Code 00B: Fractional Arc
- Codes 00C and 00D: Bulge-Specified Arcs
- Code 00E: Flag Vertical Text Command
- Text Font Descriptions
- Sample Files
- Big Font Descriptions
- Unicode Font Descriptions
- Superscripts and Subscripts in SHX Files
- Index
A script can execute any command at the command prompt except a command
that displays a dialog box. In most cases, a command that displays a dialog
box has an alternative version of the command that displays command
prompts instead of a dialog box.
Script files can contain comments. Any line that begins with a semicolon (;)
is considered a comment, and it is ignored while the script file is being
processed. The last line of the file must be blank.
All references to long file names that contain embedded spaces must be
enclosed in double quotes. For example, to open the drawing my house.dwg
from a script, you must use the following syntax:
open "my house"
The following commands are useful in scripts:
'DELAY Provides a timed pause within a script (in milliseconds)
RESUME Continues an interrupted script
RSCRIPT Repeats a script file
When command input comes from a script, it is assumed that the settings of
the PICKADD and PICKAUTO system variables are 1 and 0, respectively;
therefore, you do not have to check the settings of these variables.
A script is treated as a group, a unit of commands, reversible by a single U
command. However, each command in the script causes an entry in the undo
log, which can slow script processing. If you like, you can use UNDO Control
None to turn off the undo feature before running the script, or you can write
it at the beginning of the script itself. Remember to turn it back on (UNDO
Control All) when the script is finished.
The script that is running stops when another script command is invoked.
Overview of Command Scripts
To create a script that changes settings in a drawing
This script turns on the grid, sets the global linetype scale to 3.0, and sets layer
0 as the current layer with red as the color.
1 In a text editor, enter grid on.
2 On the next line, enter ltscale 3.0.
3 On the next line, enter layer set 0 color red 0.
74 | Chapter 6 Command Scripts