[Lisp]Save the current file in one place to save

[Lisp]Save the current file in one place to save

Order it OSAVE Save As Copy of the current file in the folder called OLD is the same folder as the current drawing. The file name will be TENFILEGOCxxx, where xxx is the 3 number will be automatically added after each command OSAVE. You remember that do not perform OSAVE command Save or Save As command current drawing.

 

(vl-load-com)
(defun c:osave (/ curpath oldpath curfname fname
bfpattern fpattern tapso somax fnamelist
strso nfname
)
(princ "\nCADViet.com (c) 2007")
(setq
curpath (getvar "DWGPREFIX")
oldpath (strcat curpath "OLD")
curfname (getvar "DWGNAME")
fname (substr curfname 1 (- (strlen curfname) 4))
Bfpattern (strcat "Z-" fname)
fpattern (strcat Bfpattern "*.dwg")
tapso nil
somax 0
)
(if (not (vl-file-directory-p oldpath))
(if (not (vl-mkdir oldpath))
(progn
(alert "\nError when create Old directory")
(exit)
)
)
)
(setq fnamelist (vl-directory-files oldpath fpattern))
(foreach fname fnamelist
(setq daiso (- (strlen fname) (strlen Bfpattern) 4)
strso (substr fname (- (strlen fname) daiso 3) daiso)
so (atoi strso)
somax (max somax so)
)
)
(setq somax (1+ somax)
strso (itoa somax)
)
(while (< (strlen strso) 3)
(setq strso (strcat "0" strso))
)
(setq nfname (strcat oldpath "\\" Bfpattern strso ".dwg"))
(command ".save" nfname)
(princ)
)
(princ "\nOSAVE - free lisp from www.cadviet.com")
(princ)

Free download [Lisp]Save the current file in one place to save

Download Mirror 01  Mirror 02  Mirror 03  Mirror 04

[Lisp]Save the current file in one place to save
Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

5 + 3 =