xiaoyingzi 发表于 2014-5-3 16:25:38

懒人用的sv$转dwg

AutoCAD经常崩溃有木有?要去临时文件夹去找sv$改成dwg,有木有?每次都要去找临时文件夹烦不烦?
在桌面生成sv$todwg文件夹,并把临时文件夹中的sv$文件复制到改文件夹,并改后缀名为dwg,懒人用的;;;使用 Lisp 函数时,如果目录路径过长,“vl-directory-files”可能会导致 AutoCAD 变得不稳定。
;;;(vl-directory-files (getvar "tempprefix") "*.sv$")

(defun c:fix ( / desktopPath my_startapp tmpfilepath)
(setq desktopPath
    (vl-registry-read "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" "Desktop")   
)
(defun my_startapp (strings / obj_wsh)
    (setq obj_wsh (vlax-create-object "wscript.shell"))
    (vlax-invoke obj_wsh 'run strings 0 0)
    (vlax-release-object obj_wsh)
)
(setq tmpfilepath (strcat desktopPath "\\sv$todwg"))
(if (not (findfile tmpfilepath)) (vl-mkdir tmpfilepath))

(my_startapp (strcat "cmd /c copy " (getvar "tempprefix") "*.sv$" " " tmpfilepath "\\*.dwg"))
(my_startapp (strcat "cmd /c copy " (getvar "savefilepath") "\\*.sv$" " " tmpfilepath "\\*.dwg"))
(my_startapp (strcat "cmd /c copy " (getvar "savefilepath") "\\*.bak" " " tmpfilepath "\\*.dwg"))
(princ)
)

xiaoyingzi 发表于 2014-5-3 16:39:06

要么更狠点,干脆直接改路径:
(setq desktopPath
    (vl-registry-read "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" "Desktop")   
)
(setq auotsavepath (strcat desktopPath "\\autosavedwg"))
(if (not (findfile auotsavepath)) (vl-mkdir auotsavepath))
(setvar "savefilepath" auotsavepath)

cxs259 发表于 2014-5-3 16:57:50

试一试,赞一个!

q3_2006 发表于 2014-5-3 18:38:21

懒人必须点个赞....我也超级懒...

hao3ren 发表于 2014-5-4 09:18:21

支持小影子,懒人才能提高工作效率

debugchen 发表于 2014-5-4 11:02:24

谢谢分享,懒人用的

tianyi1230 发表于 2014-5-4 22:33:51

这个很实用啊,天正经常崩溃!

yoyoho 发表于 2014-5-5 07:28:06

xiaoyingzi 感谢你分享程序!

tranney 发表于 2014-5-5 11:18:17

这真是人才啊,,我喜欢,哈哈,做这么多程序干嘛啊,不就是为了偷懒么,哈哈

tranney 发表于 2014-5-5 11:37:24

刚试验 运行后,有点巨卡,不知道为什么
页: [1] 2
查看完整版本: 懒人用的sv$转dwg