2013
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
Automatically Load and Run AutoLISP Routines
You can load AutoLISP routines each time you run AutoCAD. You can also
execute certain commands or functions at specific times during a drawing
session.
Overview of AutoLISP Automatic Loading
AutoCAD loads the contents of two user-definable files automatically: acad.lsp
and acaddoc.lsp.
By default, the acad.lsp file is loaded only once, when AutoCAD starts, whereas
acaddoc.lsp is loaded with each individual document (or drawing). This lets
you associate the loading of the acad.lsp file with application startup, and the
acaddoc.lsp file with document (or drawing) startup. The default method for
loading these startup files can be modified by changing the setting of the
ACADLSPASDOC system variable.
If one of these files defines a function of the special type S::STARTUP, this
routine runs immediately after the drawing is fully initialized. The S::STARTUP
function is described in
S::STARTUP Function: Postinitialization Execution
(page 86). As an alternative, the APPLOAD command provides a Startup Suite
option that loads the specified applications without the need to edit any files.
The acad.lsp and acaddoc.lsp startup files are not provided with AutoCAD. It
is up to the user to create and maintain these files.
Command Autoloader
When you load an AutoLISP file, the command definitions in the file take up
memory whether or not you actually use the commands. The AutoLISP
autoload function makes a command available without loading the entire
routine into memory. Adding the following code to your acaddoc.lsp file
automatically loads the commands CMD1, CMD2, and CMD3 from the
cmds.lsp file and the NEWCMD command from the newcmd.lsp file.
(autoload "CMDS" '("CMD1" "CMD2" "CMD3"))
(autoload "NEWCMD" '("NEWCMD"))
The first time you enter an automatically loaded command at the command
prompt, AutoLISP loads the entire command definition from the associated
82 | Chapter 7 Introduction to Programming Interfaces