In an earlier post about layer notification I mentioned how to us acaddoc.lsp to disable unreconciled layer evaluation and notification. In AutoCAD Insider I read about how this makes changes to the drawing so that if you just open a drawing and then try to close it you will be asked to save changes.
One way to partially solve this is to only make changes if there is a need to change.
(if (/= (getvar "LAYEREVAL") 0) (setvar "LAYEREVAL" 0))
(if (/= (getvar "LAYERNOTIFY") 0) (setvar "LAYERNOTIFY" 0))
If you completely want to trick AutoCAD to think no changes has been done to the drawing you can achieve this using (acad-push-dbmod) to store the modification status of a drawing and finally (acad-pop-dbmod) to restore the original status.
If you start a new drawing and run (setvar "LAYEREVAL" 0) you will find that the DBMOD system variable changes to 4. But if enclosed with (acad-push-dbmod) and (acad-pop-dbmod) no changes will be made to DBMOD and you will be able to close the drawing without any "problem". You have to do something else with the drawing to trigger AutoCAD to ask you to save the drawing if you just close it.
Here is an example of what you can add into acaddoc.lsp.
(acad-push-dbmod)
(setvar "LAYEREVAL" 0)
(setvar "LAYERNOTIFY" 0)
(acad-pop-dbmod)
(princ "\nacaddoc.lsp loaded")
(princ)
Restored comment
ReplyDeleteby ihop
Of course if those two variables were saved in the registry instead of the drawing, we wouldn't be having this conversation.... :-)
Thanks for the tip. I had tried everything. When opening a hyperlink, Autocad was opening a new file then I was being asked each time if I want to save it. Then the hyperlinked drawing would open. I needed to make sure some items were available on new drawings to users so this was a great fix. Thanks again.
ReplyDelete