April 14, 2015

ACA: -EXPORTTOAUTOCAD and the EXPERT System Variable

The EXPERT system variable can be used to suppress certain command prompts. The initial default value for EXPERT is 0 (all prompts are issued), and any change only applies to the current drawing session; it is not saved in either the drawing or the registry.

I suppose some may use this to avoid what they consider to be useless warning prompts while actually working (I benefit from being asked "Are you sure?" often enough to leave it at 0); I find it is most valuable when trying to automate a task with AutoLISP®. For example, if my routine saves the current drawing file with a different name, a drawing file with the same name may or may not exist in the specified location. While the routine could check to see if such a file exists and then adjust the command input accordingly, if I always want to overwrite the file and want to minimize the amount of code I have to write, setting EXPERT to 2 will suppress the "A drawing with this name already exists. Overwrite it?" prompt, so the same command input will work whether or not a file of that name already exists.

I was working on a routine to automate the -EXPORTTOAUTOCAD command in a particular situation. Unlike the SAVE, SAVEAS or WBLOCK commands, I discovered that there is no value to which EXPERT can be set to suppress the prompt about overwriting an existing file. Fortunately, in this particular case, I know there will be a file of that name, and I can add "_Y" to the command input to tell AutoCAD® Architecture to go ahead and overwrite the file.

No comments: