Here are some commands related to Design Center that may be useful when working with menu macros or lisp files.
- ADCSTATE – Query this system variable if you need to determine if Design Center is open or not. 1=Active, 0=Not Active
- ADCENTER – Opens Design Center
- ADCCLOSE – Closes Design Center
- ADCNAVIGATE – Use this command to set the active directory in Design Center.
Let’s say that you want to create some menu items that open Design Center to a certain directory, and that you have 3 of these to create. There is no need to create 3 separate functions to do this.
Let’s create a single function that will open Design Center and navigate to a certain directory.
(defun adc:go (dir) (if (zerop (getvar "ADCSTATE")) (command "._ADCENTER") ) (command "._ADCNAVIGATE" dir) (princ) )
Now, you can call this routine in your custom menu, like this:
[Design Center BLOCKS]^C^C(adc:go "C:\\CAD\\MYBLOCKS") [Design Center DYN BLOCKS]^C^C(adc:go "C:\\CAD\\MYDYNBLOCKS") [Design Center SEALS]^C^C(adc:go "C:\\CAD\\MYSEALS")
Now you are opening Design Center to a certain directory, using the same code over and over, by passing the name of the directory to the ADC:GO function.
Save this ADC:GO function in the MNL file that goes with the menu. If your menu file is named CUSTOM.CUI, then the MNL file should be named CUSTOM.MNL. If this file doesn’t exist, just create it.
An MNL file is just a lisp file. When a menu file is loaded, it looks for a MNL file with the same name and loads this file also.