Hi Swamp Members,
I wrote a simple lisp routine to Export a drawing file to a new file name and then delete the original file and finally rename the new file back to the original file name. The first part of the code works but the File delete and File rename does not.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;
(DEFUN C:DRFS ()
(SetVar "CMDECHO" 0)
(vl-load-com)
;;;;;;
;;;;;;Get File Name
;;;;;;
(Setq Dnam (GetVar "DWGNAME"))
(Setq Dpath (GetVar "DWGPREFIX"))
(Setq OldNam (Strcat Dpath Dnam))
(Setq Nnam (- (STRLEN Dnam) 4))
(Setq Fnam (SUBSTR Dnam 1 Nnam))
;;;;;;
;;;;;;Create New File Name
;;;;;;
(Setq NewNam (STRCAT Dpath Fnam "-new.dwg"))
;;;;;;
;;;;;;Export Clean New File
;;;;;;
(Command "Export" NewNam "*")
;;;;;;
;;;;;;Close - Rename & Delete Files
;;;;;;
(Command "Close" "Y")
(vl-file-delete OldNam)
(vl-file-rename NewNam OldNam)
(SetVar "CMDECHO" 1)
)
Can anyone take a look and see what I have done incorrectly and let me know how to resolve the problem to get the code to work properly....??
Your assistance will be appreciated....!!
Regards,
Vince