lamensterms Posted March 26, 2013 Posted March 26, 2013 Hey guys, I found this thread on the Audodesk forums the other day…http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Save-copy-of-AutoCAD-Dwg-file-using-macro/td-p/3574830 And thought it looked like a pretty good idea. So I applied the macro code to a QuickSave LISP routine and found that it does work quite well. One thing which is puzzling me… sometimes I get the message “A drawing with this name already exists. Do you want to replace it?” returned in the command line, other times I get no message and the routine completes successfully. My first thought was that I would only (and always) get that message when the message is true – when a file needs to be overwritten. This is not the case, sometimes I can run the routine, there can be an existing file of the same name in my “BackUp” directory, and I will not see the ‘overwrite’ message. My code is: (defun c:q () (vl-load-com) (command "qsave") (SETQ QSDATE (RTOS (GETVAR "CDATE") 2 0)) (vl-mkdir (strcat "D:/_DWGBackup/" QSDATE "/")) (command "_.SAVE" (strcat "D:/_DWGBackup/" QSDATE "/" (getvar "DWGNAME"))) (princ) ) I have since found a work-around (code below) for this problem, so it is not a solution that I seek – just and explanation as to why I would only sometimes get that message. (DEFUN C:q (/ newname) (setvar "CMDECHO" 0) (if (zerop (getvar "dwgtitled")) (command "._qsave" (getstring "\n Enter drawing name: ")) (command "_.qsave") ) (setvar "filedia" 0) (vl-mkdir (strcat "D:/_DWGBackup/" QSDATE "/")) (setq newname (strcat "D:/_DWGBackup/" QSDATE "/" (getvar "DWGNAME") ) ) (if (findfile (strcat newname)) (command "_.save" newname "_Y") (command "_.save" newname) ) (setvar "filedia" 1) (princ) ) Thanks for any help. Quote
pBe Posted March 26, 2013 Posted March 26, 2013 lamensterms said: That's it - thanks pBe. Glad i could help Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.