覆盖或者替换文件
当文件已经存在时,我有以下代码似乎出错。它是正在进行的 lisp 的一部分。执行此操作,然后保存,执行此操作,然后保存。等等......
但是,当文件名存在时,我尝试覆盖文件,它会停止例程的继续。
我知道如何让它工作的唯一方法是在开始例程之前删除现有文件。
(command "_.saveas" "" (getfiled "Saveas:" (strcat (getvar 'dwgprefix) "FileName") "dwg" 1))
Command:Yes or No, please.; error: Function cancelledA drawing with this name already exists.Do you want to replace it?Y
我确实查找了以下代码,但不确定如何将它们联系在一起。
(if (findfile (strcat filename ".dwg"))(command "_.save" filename "_y");;replaces the existing file (command "_.save" filename)(Alert "Did not Save over existing file.") ;;does not replace the existing file)
如果有更好的想法,我希望你不介意分享。
页:
[1]