;; Begin code here
;; Written by Lee Ambrosius
;; Created on 3/17/04

;; This routine allows to browse and open a Back or Autosave file in AutoCAD.
(defun c:ExtendedOpen(/ autoSaveFileName)
(setq autoSaveFileName (getfiled "Extended Open" (getvar "SAVEFILEPATH") "bak;sv$" 12))

(if (/= autoSaveFileName nil)
(progn
(setq autoSaveFileDwg (strcat (substr autoSaveFileName 1 (- (strlen autoSaveFileName) 3)) "dwg"))
(if (= (findfile autoSaveFileDwg) nil)
(vl-file-copy autoSaveFileName autoSaveFileDwg)
(alert "File couldn't be renamed due to drawing file with that name already exists.")
)

(if (findfile autoSaveFileDwg)
(if (= (getvar "SDI") 0)
(progn
(setq openedDwg (vla-open (vla-get-documents (vlax-get-acad-object)) autoSaveFileDwg))
(vla-put-activedocument (vlax-get-acad-object) openedDwg)
)
(command "open" autoSaveFileDwg)
)
)
)
)
(princ)
)
(defun c:EO()(c:ExtendedOpen))
;(prompt "Type ExtendedOpen or EO to beable to open BAK or SV$ files")
(princ)
;; End code here
(c:eo)

Advertisements