AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Does this happen on your system?
You close a drawing that you did not modify while it was open; however, the following prompt displays:

Save changes to <filename>?

Some applications run automatically when you open a drawing, such as an AutoLISP routine stored in acad.lsp or acaddoc.lsp. These routines can result in modifications of system variables that apply to a drawing. For this reason, you are prompted to save changes to a drawing that you did not modify.

You can modify such an AutoLISP routine to prevent this by using the new functions, acad-push-dbmod and acad-pop-dbmod.

The following excerpt is from the AutoCAD 2000 Readme file:

New Functions Provided to Prevent a Document From Being Marked "Updated"

Two new functions, acad-push-dbmod and acad-pop-dbmod, can be used to suspend and resume the $DBMOD recording mechanism that AutoCAD uses to track changes to a drawing. These functions allow applications to make changes to a document as part of their initialization process without setting flags in $DBMOD and triggering unwanted save drawing queries.

(acad-push-dbmod) pushes the current value of the $DBMOD system variable for the document onto an internal stack. The function always returns T. (acad-pop-dbmod) restores the value of $DBMOD to the most recently pushed value on the document's internal stack. The function returns T for a successful stack pop and nil if the stack is empty.

The acad-push-dbmod and acad-pop-dbmod functions are implemented in acadapp.arx, which is loaded by default on AutoCAD startup, but can be disabled, if desired.

To use the new functions, precede program actions that should not affect the value of "$DBMOD" with calls to push the $DBMOD value, then pop the value after performing the action. Here is a simple LISP example:

(acad-push-dbmod)

(setq new_line '((0 . "LINE") (100 . "AcDbEntity") (8 . "0")

(100 . "AcDbLine") (10 1.0 2.0 0.0) (11 2.0 1.0 0.0)

(210 0.0 0.0 1.0)))

(entmake new_line) ; Sets $DBMOD 1 flag

(command "_color" "2") ; Sets $DBMOD 4 flag

(command "_-vports" "_SI") ; Sets $DBMOD 8 flag

(command "_vpoint" "0,0,1") ; Sets $DBMMOD 16 flag

(acad-pop-dbmod) ; $DBMOD will again have the same value it had before.

 
The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website