This reactor, copy your previously Saved -or ExitSaved drawing to ( in this case ) the folder "C:\\DwgBackup"
the name of the file will be "Bak_Drawing3.dwg" if the parent drawing is "Drawing3.dwg"
Code:
(vl-load-com)
(defun When_Saving_And_Copy_Drawing_Function (ReactorArg ObjListArg / MyBackupPath )
(setq MyBackupPath "C:\\DwgBackup" ) ;; <-- Your EXISTING Backup Folder !
(vl-file-delete (strcat MyBackupPath "\\Bak_" (getvar "DWGNAME" )) ) ;; Erase old "Bak_" copy if exist, then
(vl-file-copy (findfile (cadr ObjListArg )) (strcat MyBackupPath "\\Bak_" (getvar "DWGNAME" )) nil ) ;; create a new "Bak_" copy
)
(setq When_Saving_And_Copy_Drawing_Reactor (vlr-dwg-reactor nil '((:vlr-saveComplete . When_Saving_And_Copy_Drawing_Function ))) )
To stop the reactor use:
Code:
(vlr-remove When_Saving_And_Copy_Drawing_Reactor ) ; Remove the reactor
(setq When_Saving_And_Copy_Drawing_Reactor nil ) ; Clear / assign nil to the reactor
(setq When_Saving_And_Copy_Drawing_Function nil ) ; Clear / assign nil to the function
: ) Happy Computing !
kennet