• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Visual LISP, AutoLISP and General Customization

    Reply
    Mentor
    alanjt_
    Posts: 218
    Registered: ‎08-25-2008

    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.

    Please use plain text.
    Valued Mentor
    Posts: 308
    Registered: ‎12-29-2009

    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 Programming
    With Mathematics there is the possibility of perfect rigour, so why settle for less?
    Just another Swamper
    Please use plain text.
    Mentor
    alanjt_
    Posts: 218
    Registered: ‎08-25-2008

    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.

    Please use plain text.
    Valued Mentor
    Posts: 308
    Registered: ‎12-29-2009

    Re: Purge on Exit

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

    Well anyway, its accounted for

    Lee Mac Programming
    With Mathematics there is the possibility of perfect rigour, so why settle for less?
    Just another Swamper
    Please use plain text.
    Mentor
    alanjt_
    Posts: 218
    Registered: ‎08-25-2008

    Re: Purge on Exit

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

    Please use plain text.