Hello,
I was directed to this forum for this question:
Is there a way to do a "save all as"?
For example, say I have 10 drawing files open and I've made changes to them, then I realize I need to keep the original versions as well as the modified versions. Is there a way to do a "save as" on all of them at the same time?
I would call myself AutoCAD proficient, but by no means an expert.
I have never used lisp before, don't know how.
Any help would be appreciated.
Thanks.
Solved! Go to Solution.
Solved by DannyNL. Go to Solution.
Solved by DannyNL. Go to Solution.
Yes, that would be possible.
Please see code below; all existing drawings will be 'saved as' to the same name with '-A' added and be closed (unless one of them is the current drawing). New drawings will be skipped.
(defun c:SaveAllAuto (/ SAA_ACObject SAA_Documents) (setq SAA_Documents (vla-get-Documents (setq SAA_ACObject (vlax-get-acad-object)))) (vlax-for SAA_Item SAA_Documents (if (/= (vla-get-FullName SAA_Item) "") (progn (vla-SaveAs SAA_Item (strcat (vla-get-Path SAA_Item) "\\" (vl-filename-base (vla-get-Name SAA_Item)) "-A.dwg") acNative) (if (/= (vla-get-HWND SAA_Item) (vla-get-HWND (vla-get-ActiveDocument SAA_ACObject))) (vla-Close SAA_Item) ) ) ) ) (mapcar 'vlax-release-object (list SAA_Documents SAA_ACObject)) (princ) )
Thank you.
I want to try this, but I don't know how. I've never used lisp before.
I don't know how to apply it in my system.
Could you please give me a quick step-by-step how to use the code?
Thank you again.
Assuming you are the only one who will be using this routine:
Just copy the contents of my code in a new text document (i.e. notepad or if you know the VLISP editor in AutoCAD you can use that as well)) and save the file to [anyname].lsp somewhere where you keep/save your other files.
For testing only, drag 'n drop that new .lsp file from your Windows Explorer into your current or new drawing. Type the command SAVEALLAUTO and press enter. All existing drawings that are now currently open will be saved to their original location, but with '-A' added to their name. After saving they will be closed as well. Your current drawing will not be closed and all other new and open drawings (so drawings with no filename yet) will be skipped.
Not for testing purposes, but when you are satisfied and want to have this command at your disposal all the time when working in AutoCAD: there are several ways, but this will probably the easiest one for you. Type the command APPLOAD and click on the contents button of the Startup Suite (lower right of the dialog). Add the .lsp to the list and the command will be loaded automatically each time you open/create a drawing.
Question: I saved the .lsp file to my desktop, then added it to the start-up suite; I want to move the .lsp file now to a different location; will it still work? or will I have to reload it?
Thanks.
Ignore my last post...
I did have to reload the .lsp file into the start-up suite after moving it, but it's working again now.
Thank you very much again!
Hello
I have a request for the solution.
Can you add code to it that would >zoom all< for each file you write?
Jerzy
As far as I know this is not possible.
This routine will save all open drawings without activating each drawing. And for Zoom commands to be used, the drawing needs to be active. So I don't think it's possible unless you use a script.
Hi!
I am also new to LISP,
I have a excel sheet which is exporting a script to make cutting files for a cnc machine. Each geometry needs to be in a separate .dxf file for the nesting software to work. My script looks like this:
"ellipse 0,0 300,0 400 new
ellipse 0,0 200,0 300 new" and so on.
This opens a large ammount of new files. Is it possible to "Save all as" for these new files to a selected folder? The file names can be default (drawing_1, drawing_2)