Creating commands that use AutoLISP is a more advanced way to use the program's customization feature.
You can use AutoLISP variables and expressions to create macros that perform complex tasks. When the program loads a CUIx file, it also loads a MNL file with the same name and in the same location. Placing AutoLISP code in a MNL file is an efficient way to load custom commands that can be used in a macro.
You can specify additional AutoLISP files to load in the Customize User Interface (CUI) Editor. Creating commands that use AutoLISP is a more advanced way to use the program's customization feature. Experimentation and practice will help you use this feature effectively.
Examples
- Preset Values
-
This example is composed of three command macros that are used to insert a block.
Command macro prompts for the window width.
^C^C^P(setq WINWID (getreal "\nEnter window width: ")) ^P
Command macro prompts for the wall thickness.
^C^C^P(setq WALLTHK (getreal "\nEnter wall thickness: ")) ^P
Command macro inserts a block named "window" and prompts for the insertion point and rotation.
^C^C_INSERT window XScale !WINWID YScale !WALLTHK
The X axis of the block is to the current window width and its Y axis to the current wall thickness.
- Resize Grips
-
This example contains two command macros that increase or decrease the current value of the GRIPSIZE system variable.
Command macro increases the value of the GRIPSIZE system variable by 1.
^P(setvar "gripsize"(1+ (getvar "gripsize")))(redraw)(princ)
Command macro decreases the value of the GRIPSIZE system variable by 1.
^P(setvar "gripsize"(1- (getvar "gripsize")))(redraw)(princ)
To add validity checking to these command macros, values less than 0 and greater than 255 cannot be used for the GRIPSIZE system variable.
- Prompt for User Input
- Call a Macro Assigned to a Pull-down Menu Item