Three other options.
1. Get rid of all code that modifies the drawing at startup.
2. Set STARTUP to 1 to open AutoCAD with a startup dialog.
3. Set STARTUP to 2 (AutoCAD 2012 and later) to open AutoCAD with no drawing loaded.
Registered forum members do not see this ad.
Most of us have encountered the AutoCAD message:
Like this:"Save changes to Drawing1.dwg?"
1.jpg
In case of a new blank drawing in wich something is changed / added / etc. this is a logical thing.
Sometimes this message appears even when nothing has changed in the drawing: opening a new AutoCAD session from scratch and then close it immediately without any input from the user results in the prompt wether so save it or not :reallymad:.
Question is why does AutoCAD prompt for this when nothing has changed. Well the answer is easy: something did change but you did not notice.
My situation: whenever AutoCAD opens a drawing, a new one or existing one, I have several Lisp routines that change setting so "the drawing behaves like I want it to". In other words: I changed some systemvariables.
In the database of AutoCAD this is seen as a change and therefore it prompts to save it or not.
In my case I have been pressing "no" for like a year or so. But now I found a way to protect myself against this prompt.
If one is interested, please investigate the next two AutoCAD functions: acad-push-dbmod & acad-pop-dbmod. It is very simple to understand but I never had heard of it. I just happend to find it, lucky me.
This is a small piece of code how I use it (based on some idea's from David Bethel):
I thought maybe this can be of help to anyone else.Code:(defun SomeFunction (/ CmdEchoOld rst v var) (vl-load-com) ; load activeX functions (acad-push-dbmod) (setq CmdEchoOld (getvar 'CMDECHO)) (setq var '( ("CMDECHO" . 0) ("OSMODE" . 229) ("ORTHOMODE" . 1) ("GRIDMODE" . 0) ;; create your own list ) ) ;_setq (foreach v var (and (getvar (car v)) (setq rst (cons (cons (car v) (getvar (car v))) nw_rst)) (setvar (car v) (cdr v)) ) ;_and ) ;_foreach (setvar 'CMDECHO CmdEchoOld) (acad-pop-dbmod) (princ) ) ;_defun (SomeFunction) ; AutoLoad
Of course I am open to any additional info / suggestions / comments.
Regards.




Three other options.
1. Get rid of all code that modifies the drawing at startup.
2. Set STARTUP to 1 to open AutoCAD with a startup dialog.
3. Set STARTUP to 2 (AutoCAD 2012 and later) to open AutoCAD with no drawing loaded.
Code:;;;--------------------------------------------------------------------; ;;; Load personal settings (defun c:LoadPersonalSettings (/ vars var val) (setq vars '(("cmdecho" . 0) ("osmode" . 229) ("orthomode" . 1) ("gridmode" . 0))) (foreach v vars (if (/= (setq val (cdr v)) (getvar (setq var (car v)))) (setvar var val))) (princ)) ;;;--------------------------------------------------------------------; ;;; Load personal settings - shortcut (defun c:LPS () (c:LoadPersonalSettings)) ;;;--------------------------------------------------------------------; ;;; Conditional load (if (= 1 (getvar 'dwgtitled)) ; If drawing is named (i.e., not Drawing1.dwg) (c:LPS)) ; Then load personal settings ;;;--------------------------------------------------------------------; (princ) ; Silent load
Last edited by BlackBox; 27th Apr 2011 at 07:33 pm.
"Potential has a shelf life." - Margaret Atwood
Thanks for the replies!
@ rkmcswain:
Your suggestions are no option to me: I want AutoCAD to set some variables the way I want.
None of your suggestions will work the way I would like.
Thanks anyway for sharing your idea!
@ RenderMan
Nice idea but this would mean that a new drawing is not set how I want them.
So I need to save the file with a decent name and then close / reopen it.
Thanks also!
-> Still stick to my approach <-
Your comments contradict the thread title.
I'm not sure you understand the point... if you're not going to save Drawing1.dwg (i.e., avoid the "Save" prompt), then don't change the drawing at all.
Could you not just change the desired System Variables in your Template (.DWT) to avoid -> your approach <- altogether...?![]()
"Potential has a shelf life." - Margaret Atwood



thanks marco for this topic, i have been interested in this ever since i started using a lisp to change a load of my variables
now i am interested to see which method i will use........ let the discussion continue!
Well, in that case...
Avoid touching the mouse wheel while drawing1.dwg is open. That causes about 99.9% of the cases where AutoCAD thinks you have changed drawing1.dwg. Even an unintentional zoom will set the change flag whether you move back to the original view or not.
Yogi Berra: "In theory there is no difference between theory and practice. In practice there is."
What do you mean by "contradict"? I found why AutoCAD propmts for the and wanted to share my solution. It works and suits my situation. And since I do not contribute as much as others do to the forum I thought I'd share this.
So let me return the question: do you understand the point? If I open an existing AutoCAD drawing by windows explorer then AutoCAD opens an empty drawing and the file I selected in the explorer.
Without this code it remains and closes only after the prompt. With the code, the drawing1.dwg is closed automatically, I do not even notice it being opened.
@ DesignerStuart: thanks for your reply. Let's see where this ends. In my case it works just fine!
Perhaps I've overlooked something; correct me where I may be wrong.
The thread title is "How to prevent the 'Save Changes to Drawing1.dwg' message", and yet advocate changing system variables despite having no desire to save Drawing1.dwg ... this appears (to me) to be a contradiction.
Why expend effort, only to discard the result?
(^^ Sun Tzu would not approve ^^)
If one wants to avoid the "Save Changes to Drawing1.dwg" prompt, the solution is simple... don't make changes prior to opening another, titled drawing.
If you want to customize the System Variables (in a blank drawing), then the simplest solution is for those changes to be saved to your drawing template (DWT).
However, not everyone has write-access to their DWT(s). Hence the code I posted... If a titled drawing is opened, one's personal settings are loaded automatically. However, if Drawing1 (a blank drawing) is opened, one's personal settings are not loaded... but it (SomeFunction) is still available to be manually called without the need to save the drawing, close, and re-open.
I provide my users with a keyboard command for this (Example c:SomeFunction).
I've not made any attempt to deter you from posting things you feel will help others. Doing so is an admirable pursuit, and appreciated, as designerstuart has already pointed out.
I do not experience this behavior... when I open a drawing from Windows Explorer only that drawing is opened, and not Drawing1.
"Potential has a shelf life." - Margaret Atwood




Registered forum members do not see this ad.
Guys...what difference does it make? If you don't want to do it that way, don't do it. I quite often open autocad to do some little something, sometimes just to see if it works, or to recreate a question that someone here has posted and don't save the drawing. Sometimes I do it because of some cryptic file name and the little preview bmp isn't big enough to tell what it is, so I open it to see if its what i'm looking for. If it's not, there is absolutely no reason to save it again.
Now having said that, being the forgetful old windbag I am, I rely on that very dialog box to keep me from screwing up and either not saving something I should, or saving something I shouldn't.![]()
Never try to teach a pig to sing. It wastes your time and annoys the pig. -Robert Heinlein
Bookmarks