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
$M=expression
Introducing the macro with $M= tells AutoCAD to evaluate a string as a DIESEL
expression, and that expression is the DIESEL expression. The following example
defines a conditional expression in a macro:
FILLMODE $M=$(-,1,$(getvar,fillmode))
The macro switches the FILLMODE system variable on and off by subtracting
the current value of FILLMODE from 1 and returning the resulting value to
the FILLMODE system variable. You can use this method to toggle system
variables whose valid values are 1 or 0.
Termination of Macros That Contain Conditional Expressions
If you use the DIESEL string language to perform “if-then” tests, conditions
might exist where you do not want the normal terminating space or semicolon
(resulting in Enter). If you add ^Z to the end of the macro, AutoCAD does not
automatically add a space (Enter) to the end of the macro expression.
As with other control characters in commands, the ^Z used here is a string
composed of ^ (a caret) and Z and is not equivalent to pressing Cmd-Z.
In the following examples, ^Z is used as a macro terminator.
^C^C$M=$(if,$(=,$(getvar,tilemode),0),$S=mview _mspace )^Z
^C^C$M=$(if,$(=,$(getvar,tilemode),0),$S=mview _pspace )^Z
If these macros did not end with ^Z, AutoCAD would automatically add a
space (Enter), repeating the last command entered.
See also:
Use Special Control Characters in Macros (page 42)
DIESEL (page 63)
Use AutoLISP in Macros
Creating commands that use AutoLISP is a more advanced way to use the
AutoCAD customization feature.
You can use AutoLISP variables and expressions to create macros that perform
complex tasks. To use AutoLISP efficiently in macros, place AutoLISP code in
48 | Chapter 4 User Interface Customization