Saturday, December 8, 2007

Make changes to a drawing without changing DBMOD

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.

(setvar "LAYEREVAL" 0)
(setvar "LAYERNOTIFY" 0)
(princ "\nacaddoc.lsp loaded")

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner