Hi,
I need use (command ".save" pth) in my reactor for automatic back up after 30 minutes. But I can not figure out how to write this in Visual LISP. I want save current unsaved dwg to new file, but current dwg has to remain unchanged and still be active.
Method (vla-saveAs doc) makes new file but makes active just this new file and close the old one. (vla-save doc) saves only without creating new file.
Following code is a part of commandEnded callback reactor:
(defun GM:createBackUp (cmd / doc pth)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq pth (strcat (getvar "TEMPPREFIX")
(vl-string-right-trim ".dwg" (getvar "DWGNAME"))
"_"
(rtos (getvar "CDATE") 2 6)
".dwg"))
(if (not (wcmatch cmd "QSAVE,SAVEAS"))
(progn
;(command ".save" pth) ;;;!!!!
(princ "\nCurrent drawing has been saved."))
(vl-file-copy (strcat (getvar "DWGPREFIX") (getvar "DWGNAME")) pth))
(princ (strcat "\nBackup \"" (getvar "DWGNAME") "\" has been created. (" pth ")")))
Thanks.