Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Valued Mentor
489 Posts
51 Kudos
Registered: ‎08-25-2008
Post 11 of 15

Re: Purge on Exit

01-11-2012 09:31 AM in reply to: Lee_Mac

So, what happens if the user is just opening a drawing to extract something, or look at something. No changes are made, but now it will be purged and saved with a new date.

*Expert Elite*
1,307 Posts
333 Kudos
Registered: ‎12-29-2009
Post 12 of 15

Re: Purge on Exit

01-11-2012 10:19 AM in reply to: alanjt_

alanjt_ wrote:

So, what happens if the user is just opening a drawing to extract something, or look at something. No changes are made, but now it will be purged and saved with a new date.


Ok, to account for the remote possibility that DBMOD remains unchanged:

 

(vl-load-com)
(if (null *editor-reactor*)
    (setq *editor-reactor* (vlr-editor-reactor nil '((:vlr-beginclose . purgedwg))))
)
(defun purgedwg ( reactor params )
    (if (null *acdoc*)
        (setq *acdoc* (vla-get-activedocument (vlax-get-acad-object)))
    )
    (if
        (and
            (= 1 (getvar 'DWGTITLED))
            (= 0 (getvar 'DBMOD))
            (equal (getvar 'TDUPDATE) (getvar 'DATE) (/ 5.0 86400.))
        )
        (progn
            (repeat 3 (vla-purgeall *acdoc*))
            (vla-save *acdoc*)
        )
    )
    (princ)
)
(princ)

 

Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)
Expert Elite
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Valued Mentor
489 Posts
51 Kudos
Registered: ‎08-25-2008
Post 13 of 15

Re: Purge on Exit

01-11-2012 10:22 AM in reply to: Lee_Mac

Far from a remote possibility.

 

Hell, open a set of drawings just for printing purposes, but users taking objects from one drawing (that remains unedited) is a normal occurance.

*Expert Elite*
1,307 Posts
333 Kudos
Registered: ‎12-29-2009
Post 14 of 15

Re: Purge on Exit

01-11-2012 10:38 AM in reply to: alanjt_

Well anyway, its accounted for

Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)
Expert Elite
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Valued Mentor
489 Posts
51 Kudos
Registered: ‎08-25-2008
Post 15 of 15

Re: Purge on Exit

01-11-2012 10:42 AM in reply to: Lee_Mac

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post