如此简单的QSAVE?
本帖最后由 尘缘一生 于 2023-5-19 23:40 编辑不时被要求,存文件加时间标记,言有个什么的插件这个功能好 “牛”,你三领不作吗?如此云云,果真如此否?
那么,对于喜欢用参照的用户呢?存的文件名称都变了,若此文件还用于被其他文件参照呢?参照将丢失无效,更不用说,单位联网互相参照设计的企业了
鉴于此啊,哪么有人总喜欢要呢?还是需要提供为好,为此,《三领设计 V3.0》作点尝试,办法比较笨,加乒乓开关,供不同用户舍取....
链接:https://pan.baidu.com/s/121F2iYHurAheMcxlJAJjRw
提取码:iojf
本来想作15分钟判定保存,没来得及更深入,希望高手提供这部分。。。
[*];;图纸存为:名称(当前时间),以分钟间隔----------c:slqsave
[*];;MODIFY 三领设计 尘缘一生QQ:15290049
[*](defun c:tt (/ name dwgpath k basename ext fullname bakname path time newname)
[*](setq name (Vlax-Get (Vlax-Get *Acad* 'ActiveDocument) 'Name))
[*](setq time (menucmd "m=$(edtime,$(getvar,DATE),YYYY-MO-DD HH-MM)"))
[*](if (not (sl:Saved-p)) ;(= (getvar "dwgtitled") 0) ;图纸还没有保存,则保存缺省名
[*] (progn
[*] (setq dwgpath (strcat (getvar "DWGPREFIX") "user-all.dwg"))
[*] (while (/= (findfile dwgpath) nil)
[*] (setq dwgpath (strcat (getvar "DWGPREFIX") "user-all" (slsjqs) ".dwg"))
[*] )
[*] (command "_.QSAVE" dwgpath)
[*] )
[*])
[*](setq fullname (Vlax-Get (Vlax-Get *Acad* 'ActiveDocument) 'FullName))
[*](setq path (vl-filename-directory fullname))
[*](setq ext (vl-filename-extension name))
[*](setq basename (vl-filename-base name))
[*](setq bakname (strcat path "\\" basename ".bak"))
[*](if (wcmatch (strcase name)"*`(####-##-## ##-##`).DWG") ;如果文件已带有时间格式了
[*] (setq newname (strcat path "\\" (substr basename 1 (- (strlen basename) 18)) "(" time ")" ext))
[*] (setq newname (strcat path "\\" basename "(" time ")" ext))
[*])
[*](if (= (strcase fullname) (strcase newname))
[*] (command "_.QSAVE")
[*] (progn
[*] (setq k (sl:do1ordo2 "名称是否+时间?" "名称不变" "随时更名"))
[*] (if (= k "名称不变")
[*] (command "_.QSAVE")
[*] (vl-cmdf "SAVEAS" "" newname)
[*] )
[*] )
[*])
[*](if (= (getvar 'ISAVEBAK) 1) ;检测是否需要备份
[*] (vl-file-rename fullname (strcat path "\\" (vl-filename-base newname) ".bak"))
[*] (sl:del-fil fullname)
[*])
[*](if (vl-file-size bakname) (sl:del-fil bakname))
[*](princ)
[*])
三领全版
[*];;图纸存为:名称(当前时间),以分钟间隔----------c:slqsave
[*](defun c:tt (/ name dwgpath k basename ext fullname bakname path time newname)
[*](setq name (Vlax-Get (Vlax-Get *Acad* 'ActiveDocument) 'Name))
[*](setq time (menucmd "m=$(edtime,$(getvar,DATE),YYYY-MO-DD HH-MM)"))
[*](if (not (sl:Saved-p)) ;(= (getvar "dwgtitled") 0) ;图纸还没有保存,则保存缺省名
[*] (progn
[*] (setq dwgpath (strcat (getvar "DWGPREFIX") "user-all.dwg"))
[*] (while (/= (findfile dwgpath) nil)
[*] (setq dwgpath (strcat (getvar "DWGPREFIX") "user-all" (slsjqs) ".dwg"))
[*] )
[*] (command "_.QSAVE" dwgpath)
[*] )
[*])
[*](setq fullname (Vlax-Get (Vlax-Get *Acad* 'ActiveDocument) 'FullName))
[*](setq path (vl-filename-directory fullname))
[*](setq ext (vl-filename-extension name))
[*](setq basename (vl-filename-base name))
[*](setq bakname (strcat path "\\" basename ".bak"))
[*](if (wcmatch (strcase name)"*`(####-##-## ##-##`).DWG") ;如果文件已带有时间格式了
[*] (setq newname (strcat path "\\" (substr basename 1 (- (strlen basename) 18)) "(" time ")" ext))
[*] (setq newname (strcat path "\\" basename "(" time ")" ext))
[*])
[*](if (= (strcase fullname) (strcase newname))
[*] (vl-cmdf "_.QSAVE")
[*] (cond
[*] ((= $Lgver 1)
[*] (setq k (sl:do1ordo2 "名称是否+时间?" "名称不变" "随时更名"))
[*] (if (= k "名称不变")
[*] (vl-cmdf "_.QSAVE")
[*] (vl-cmdf "SAVEAS" "" newname)
[*] )
[*] )
[*] ((= $Lgver 2)
[*] (setq k (sl:do1ordo2 "嘿琌+丁" "嘿ぃ跑" "繦"))
[*] (if (= k "嘿ぃ跑")
[*] (vl-cmdf "_.QSAVE")
[*] (vl-cmdf "SAVEAS" "" newname)
[*] )
[*] )
[*] ((= $Lgver 3)
[*] (setq k (sl:do1ordo2 "Name+Time?" "Name no changed" "Change name at any time"))
[*] (if (= k "Name no changed")
[*] (vl-cmdf "_.QSAVE")
[*] (vl-cmdf "SAVEAS" "" newname)
[*] )
[*] )
[*] )
[*])
[*](if (= (getvar 'ISAVEBAK) 1) ;检测是否需要备份
[*] (vl-file-rename fullname (strcat path "\\" (vl-filename-base newname) ".bak"))
[*] (sl:del-fil fullname)
[*])
[*](if (vl-file-size bakname) (sl:del-fil bakname))
[*](princ)
[*])
5分钟j间隔判定
[*]
[*];;图纸存为:名称(当前时间),以5分钟间隔----------
[*](defun c:slqsave (/ name dwgpath k basename ext fullname bakname path time newname)
[*](if (not (sl:Saved-p)) ;(= (getvar "dwgtitled") 0) ;图纸还没有保存,则保存缺省名
[*] (progn
[*] (setq dwgpath (strcat (getvar "DWGPREFIX") "user-all.dwg"))
[*] (while (/= (findfile dwgpath) nil)
[*] (setq dwgpath (strcat (getvar "DWGPREFIX") "user-all" (slsjqs) ".dwg"))
[*] )
[*] (command "_.QSAVE" dwgpath)
[*] )
[*])
[*](if (= $sltime nil) (setq $sltime (getvar "millisecs")))
[*](setq name (Vlax-Get (Vlax-Get *Acad* 'ActiveDocument) 'Name))
[*](setq time (menucmd "m=$(edtime,$(getvar,DATE),YYYY-MO-DD HH-MM)"))
[*](setq fullname (Vlax-Get (Vlax-Get *Acad* 'ActiveDocument) 'FullName))
[*](setq path (vl-filename-directory fullname))
[*](setq ext (vl-filename-extension name))
[*](setq basename (vl-filename-base name))
[*](setq bakname (strcat path "\\" basename ".bak"))
[*](if (wcmatch (strcase name)"*`(####-##-## ##-##`).DWG") ;如果文件已带有时间格式了
[*] (setq newname (strcat path "\\" (substr basename 1 (- (strlen basename) 18)) "(" time ")" ext))
[*] (setq newname (strcat path "\\" basename "(" time ")" ext))
[*])
[*](if (< (- (getvar "millisecs") $sltime) 300000)
[*] (command "_.QSAVE")
[*] (progn
[*] (setq k (sl:do1ordo2 "名称是否+时间?" "名称不变" "随时更名"))
[*] (if (= k "名称不变")
[*] (command "_.QSAVE")
[*] (vl-cmdf "SAVEAS" "" newname)
[*] )
[*] )
[*])
[*](if (= (getvar "ISAVEBAK") 1) ;检测是否需要备份
[*] (vl-file-rename fullname (strcat path "\\" (vl-filename-base newname) ".bak"))
[*] (vl-file-delete fullname)
[*])
[*](if (vl-file-size bakname) (vl-file-delete bakname))
[*](setq $sltime (getvar "millisecs"))
[*](princ)
[*])
养成随手保存的习惯,自动保存会卡顿,会影响画图心情的。 cghdy 发表于 2023-5-20 08:30
养成随手保存的习惯,自动保存会卡顿,会影响画图心情的。
这个什么功能?
不运行这个程序,就不会效果,这不是自动保存。 1{:1_1:}
厉害!!
页:
[1]