AutoCAD Variables… We have hundreds of them inside AutoCAD. The importance of variables should not be underestimated. In this article I’ll try to show the dangerous aspects of wrong settings and handling of AutoCAD variables and ways to avoid the negative results.
Once I was involved in work on a project which was completely dedicated to XReferences modifications. Nothing serious: freeze-thaw XRef layers, change their colors etc. After several hours of work when the half of the drawings were finished I sent them to print. The plotted sheets showed that all my changes in XRefs were ignored: the status of all objects on XReferenced layers did not change since I started this project. I surely saved each drawing before closing.
I took me hours to find the AutoCAD variable VISRETAIN responsible for that bad result (half of the day of wasted time). In all drawings it was set to 0 (should be 1). What AutoCAD HELP tells about VISRETAIN, if the latter was set to 0 (I shortened the help topic):
...Changes made to xref-dependent layers in the current drawing are valid in the current session only and are not saved with the drawing.
I would consider VISRETAIN as one of the most dangerous variables. The illness of the drawing can be diagnosed only when you send it to print or reopen the file which you've been 'modifying'.
The second variable I would mention is PSLTSCALE. The purpose of this variable is to display linetypes identically. Have you ever met the situation when dashed or centerlines looks like continuous lines in PaperSpace? To fix the problem you try to play around with different setting of LTSCALE or - even worse - change the linetype scale of objects. That usually gives no good results. The solution is easy. Check PSLTSCALE value - Most likely it was set to 0. Set it to 1. See the result.
It is difficult to say how many times I have heard from AutoCAD users the desperate appeal for help them restore Open-Save dialog window. The other day I've read on-line: "Fact is, I spent 3 weeks without the 'open window'..." When you have only command prompt today, in 2004, it is a big loss, if not a grief - you lost your best friend you used to call many times per a day. Remember 7 characters F I L E D I A you should never forget, set that variable to 1 and get your invaluable dialog window back.
The close relative of FILEDIA is CMDDIA. Let's make an experiment: set CMDDIA to 0. Start qleader or leader command. When you are prompted to enter MTEXT, the command terminates. Set CMDDIA to 1 in order to restore MTEXT editor.
Some times it looks like simple things are discontinuing to work in AutoCAD. The frequent complains are relevant to the disability to modify images in AutoCAD: you cannot select, change size, delete, move or copy the image. IMAGEFRAME variable should be ON. Turn it OFF, if you would like to prevent the user from accidentally selecting of image.
Another form of disability (the terrible one) you can get while dimensioning. You started to add dimension:
Specify first extension line origin or <select object>:
Specify second extension line origin: 1.5
Specify dimension line location or
Everything goes OK. But look at the next line:
Enter dimension text <1 1/2">: 1 1/2"
In one moment the things turned upside down: you are forced to enter text (certainly you are not able to apply the stacked format) and besides your dimension is exploded (you respect the associativity!) You logically are trying to change the current dimension style. Useless: there is nothing about dimension associativity in 'Dimension Style Manager'. Are you in a dead-lock? - Not really. Enter DIMASSOC at the command prompt. In above-mentioned scenario DIMASSOC was set to 0. Change it to 1 or 2 (the last value for 2002 or later AutoCAD version).
Remark: DIMASSOC replaced the old (prior to ACAD2002) variable called DIMASO.
Briefly about another dimension variable: DIMTIX. Look at the pictures below:
Bad dimension chain: you need to edit the position of text
DIMTIX = 1
Draws dimension text between the extension lines
When you are adding dimensions, especially the dimension chain, the preferable value of DIMTIX = 1- it saves time.
The serious problem you can meet while working on large scale projects: You add hatch (concrete or gravel) and it looks bad (see the pair of pictures below). The problem shows up when the hatch was added in the area located too far from SNAPBASE (the AutoCAD variable, which is actually a point). Examples of hatch below were added in the area with coordinates 150000,100000 (SNAPBASE setting was 0,0).
Set the new value of SNAPBASE (as a respond pick the point close to the area where you are suppose to add the new hatch) - and you are able to produce the different result, as shown below.
I'm certain in statement: the people working in AutoCAD should have iron nerves. During the AutoCAD session there is a chance you will lose your nerves. Have you ever seen this message:
At first day when you started to get that alert the evolution of your responses can be as following:
Responses 1st to 3rd: "No problem, I will proceed and press OK"
Responses 10th to about 20th: "Why on the earth I'm getting this stupid question?"
By the end of the day you are almost crying: " I am sick and tired of this! Of course I want to proceed!!! ..."
...Tomorrow - the same scenario? - NOT really, if you know about the existence of REGENAUTO variable. Set it to ON and get relief.
Another annoying problem can be caused by small or big add-ons for AutoCAD. Some of the routines written in AutoLISP or VBA are using at the start turning off osnap (OSMODE variable 0). Due to wrong routine performance or for other reasons the original osnap setting (before starting the routine) might not be restored after the command is complete. And you have to restore your preferable osnap setting starting from scratch: open 'Object Snap' dialog window (command osnap) and check object snap modes of your choice (intersection, nearest, center etc.). This operation can be repeated 20 or even more times per a day. It takes time, really. To make osnap restoring faster, use the simple solution. First establish your preferences: check options in 'Object Snap' dialog window. Next enter OSMODE at the command prompt - get the number (e.g. 695). Use the AutoLISP command:
(defun C:`()(setvar "OSMODE" 695))
Back apostrophe ` (the very first button next to 1 on keyboard) is used for launching of this command. You certainly can assign another shortcut, just make it short, not like MYROUTINEFORRESTORINGOSMODE.
Sure, it is. The variables in AutoCAD (the optimal values) can be under your control. I'm not considering in this article the solution based on editing of AutoCAD menu. Menu editing is pretty dangerous by itself, especially for beginners in AutoCAD. Better to use the solution ready for use. There is a program called NYacadFREE (yes, I'm the author of this small and FREE add-on for AutoCAD), which has the command RV (Restore Variables). What does this command do? Look at the lines of AutoLISP code provided with this program (file NYacadFREE.lsp). The most of variables were mentioned in this article. If you would like to add new variables or remove existing ones from the list below, feel free to do it. Just follow the syntax of AutoLISP or read the NYacadFREE HELP file for more information.
;;;;;;;;;;;;;;;;;;;Restore AutoCAD variables
(setvar "CMDECHO" 0);DO NOT CHANGE THIS LINE
(setvar "MIRRTEXT" 0)
(setvar "VISRETAIN" 1)
(setvar "PDMODE" 1)
(setvar "ATTDIA" 1)
(setvar "FILEDIA" 1)
(setvar "CMDDIA" 1)
(setvar "PSLTSCALE" 1)
(setvar "TEXTFILL" 1)
(COMMAND "REGENAUTO" "ON")
(setvar "CMDECHO" 1); DO NOT CHANGE THIS LINE
One command will restore the optimal values of dangerous AutoCAD variables. When you open an AutoCAD drawing and you are not sure, whether the setting is good or not, better type RV and press Enter.
NYacadFREE main page: http://www.nyacad.com/NYacadFREE.htm
You can download the program at: http://www.nyacad.com/Download.htm
* * * * *