Home Products Free Stuff Downloads Buy On-Line Articles Contact us

Download printer friendly PDF: Horror in AutoCAD-4. The Final Conflict


Three years ago in Horror-2.Dangerous variables I wrote about FILEDIA variable (section 'My best friend gone'): if it was accidentally changed to 0, the work in AutoCAD, without Open-Save dialog window became a pain. Simple solution was recommended: using AutoLISP to restore FILEDIA as well as other important variables in normal state.

Three years ago,  when current version of AutoCAD was 2005, that solution worked fine: just invoke AutoLISP command couple of times  a day to restore variables, not a big deal.


The things changed when AutoCAD2007 was released. This version of AutoCAD brought revolution in 3D and worst and slowest performance of AutoCAD VBA. I used to loose normal state of FILEDIA 10-15 times a day. Mainly accidental changing of  FILEDIA happened after implementing of VBA procedures, even without changing FILEDIA in VBA code.


In order to fix the problem I invite you to try two ways...




If you are not happy with the command, you can redefine it. This is the first solution. The most popular illustration of this procedure found in AutoCAD AutoLISP Help or on the Internet is redefine the LINE command. By using the sample of code:


(princ "
Shouldn't you be using PLINE?\n")


every time you are performing LINE command, the prompt displays an attentive reminding:


Shouldn't you be using PLINE?


Take your time, think twice, remember, right at this moment you have to make a critical decision: what to draw - line or polyline? That's the question.

Alternatively you may change this line of AutoLISP code:


(princ "I will go to the gym three times a week. I swear!\n") or

(princ "On Friday do not forget to buy flowers for Tania. Friday is the 55th day since our first date\n")


So AutoCAD will remind you about practical and important things dozens or even hundreds times a day, every time you are invoking the Line command.


Now back to our problem: we always need Open-Save dialog Window for Open, Save or SaveAs commands. LISP for SaveAs:




INITDIA function forces the display of the dialog box.

Testing...Set FILEDIA 0, then SaveAs...



OK, works! Apply similar code to command Save:




Save new lines of AutoLISP code as a separate file and add it in StartUp suite. All done?

- Not yet...There is a problem with Open.

For some reason redefining using similar to above-shown code doesn't work with this command. Even worse! The horrible thing happens - the AutoCAD is not responding to Open command.


WARNING! If you already made a poison injection in AutoCAD (saved and used AutoLISP with redefine Open command), here is an antidote: type REDEFINE, Enter, Open and finish by pressing Enter. Close AutoCAD, open AutoLISP file and remove code for redefining of Open command. Save and close AutoLISP. Start AutoCAD, try Open.


We shouldn't be worried, that solution 1 is not working with Open command, because we have


I would recommend this solution. Short AutoLISP:


(defun C:FI1()
(setvar "CMDECHO" 0)
(setvar "FILEDIA" 1)
(setvar "CMDECHO" 1)


plus modified macro ^C^CFI1;_open associated with Open button does the thing.



When you try Open, AutoLISP command FI1 first changes FILEDIA to 1, after that Open-Save dialog window appears on the screen, always!

And you will never get



If you are not comfortable with AutoLISP, you can use macros:





Hopefully it was THE FINAL CONFLICT with FILEDIA, the end of war!



Alex Borodulin