Is there a way to Open/Qsave/Close a group of files automatically

Is there a way to Open/Qsave/Close a group of files automatically

canadamcadusa
Explorer Explorer
945 Views
16 Replies
Message 1 of 17

Is there a way to Open/Qsave/Close a group of files automatically

canadamcadusa
Explorer
Explorer

Hello,

 

As the title says, I am looking for a way to open/save/close a folder full of files. The reason, is that I can update the fields within the drawings so that I can then extract all the block attribute information. 

I have tried using Express tools SaveAll, but it will only save the drawings that have been modified since opening. 

The painful work around that I have been using is to open all the files, and the rightclick each of their tabs and select save(seems to be the quickest way to physically do it). Once I have done them all, I then use the closeall command and extract the information I am needing. 

I am also aware that I can just open all the files and then extract all the data while they are open. But I am looking for a way to just have all the files save over themselves so that I don't have to open all 100-300 cad files(usually have to do them in chunks of 50 or so at a time). 

I would think that a lisp could do it, as I have seen other lisps that can open drawings and close them again, but I don't know enough about them to modify it to save the file as well. 

Thanks,

0 Likes
Accepted solutions (3)
946 Views
16 Replies
Replies (16)
Message 2 of 17

cadffm
Consultant
Consultant
Accepted solution

Hi,

If DWGCONVERT not works, you can use a script and a way to run this tool in "all" drawings.

 

ScriptPro is a tool what can do that (linked to acad.exe)

With a script.scr file content:

_QSAVE

 

Use AutoCAD ScriptPro as searchphrase in www and you will find a lot of ways to run a batch job.

 

 

 

Sebastian

0 Likes
Message 3 of 17

DGCSCAD
Collaborator
Collaborator
Accepted solution

The attached file, BatchOSC.lsp is a LISP file that will process (Open/Save/Close) every drawing in a selected directory.

 

Usage:

  1. DL and save BatchOSC.lsp to a support/trusted directory.
  2. Drag/drop Batch.lsp onto any dwg that is NOT in the directory you will be processing dwgs from.
  3. Type: BatchOSC
  4. Locate the directory to process dwg files.
AutoCad 2018 (full)
Win 11 Pro
0 Likes
Message 4 of 17

pendean
Community Legend
Community Legend

SAVEALL and CLOSEALL are all core commands for quite a few versions now @canadamcadusa 

0 Likes
Message 5 of 17

baksconstructor
Advocate
Advocate

RL.PNG

0 Likes
Message 6 of 17

canadamcadusa
Explorer
Explorer

SAVEALL only works if the drawings have modifications to them. If the drawings are just opened and nothing is modified, then SAVEALL does not do anything. and the fields will not be updated when batch plotting or extracting information from the files. 

0 Likes
Message 7 of 17

canadamcadusa
Explorer
Explorer

I will give this a try. 

 

Thanks, 

0 Likes
Message 8 of 17

canadamcadusa
Explorer
Explorer

I will give this a try. 

Thanks, 

0 Likes
Message 9 of 17

pendean
Community Legend
Community Legend

@canadamcadusa wrote:

...If the drawings are just opened and nothing is modified, then SAVEALL does not do anything...


That is how it is supposed to work, but for some with customizations, that's not true anymore. Is it tested at your end to be that way for you?

Why do you want to save a file again if it has already been saved and does not need to be saved?

 


@canadamcadusa wrote:

...and the fields will not be updated when batch plotting or extracting information from the files. 


But that's not in your original ask, is that now a requirement too? Open, extract info, update fields, then plot then save then close?

 

0 Likes
Message 10 of 17

canadamcadusa
Explorer
Explorer

I was unable to locate the lisp you have shown above, otherwise I think that it looks like it would achieve what I was hoping to do. 

Thanks, 

0 Likes
Message 11 of 17

canadamcadusa
Explorer
Explorer

This worked wonders! Obviously still takes a while to save all the drawings, but at least I a free to do other things while it is doing the saving. 

Thank you!

0 Likes
Message 12 of 17

DGCSCAD
Collaborator
Collaborator

Glad you got it sorted. If you have any questions about how it all works, ask away and either myself or the other helpful members here will have answers for you.

 

Here's to longer coffee breaks.

AutoCad 2018 (full)
Win 11 Pro
Message 13 of 17

canadamcadusa
Explorer
Explorer

@pendean wrote:

@canadamcadusa wrote:

...If the drawings are just opened and nothing is modified, then SAVEALL does not do anything...


That is how it is supposed to work, but for some with customizations, that's not true anymore. Is it tested at your end to be that way for you?

Why do you want to save a file again if it has already been saved and does not need to be saved?

 


@canadamcadusa wrote:

...and the fields will not be updated when batch plotting or extracting information from the files. 


But that's not in your original ask, is that now a requirement too? Open, extract info, update fields, then plot then save then close?

 


"As the title says, I am looking for a way to open/save/close a folder full of files. The reason, is that I can update the fields within the drawings so that I can then extract all the block attribute information. 

I have tried using Express tools SaveAll, but it will only save the drawings that have been modified since opening. "

 

Maybe I didn't state it perfectly, but I say that I need to get the fields to update so that I can extract the data. The fields won't update in the file unless the drawing is saved again, and SAVEALL does not do anything unless there are modifications to the drawing. Fields updating automatically does not count as a modification, at least not to my AutoCAD. For example;

The title block of the drawing uses the file name to be the drawing no.
If I change the file name and extract the data from titleblock without opening the drawing, it doesn't get updated.
If I open the file, it will show the new name in the titleblock, but closing the file again after this does not save that name in the title block. So if I then extract again after closing the file, it is still the old name. 
The file needs to be opened to update the field, then saved so that the field update is retained. 

This is just one example of a field in the drawing that needs to be updated so that it can be extracted. 

 

This also seems to apply to batch plotting. I didn't mention it in the original message, as I noticed it afterwards, but it still applies regardless. 

0 Likes
Message 14 of 17

pendean
Community Legend
Community Legend

@canadamcadusa REGENALL updated FIELDs, always has.

and when you OPEN a DWG file, the FIELDs are updated as well.

BUT... ensure you are not just fighting your own chosen settings for FIELDEVAL

https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-EF5D2DDE-A170-4BB4-8F76-7F3FAFE30E56

 

 

0 Likes
Message 15 of 17

cadffm
Consultant
Consultant
Accepted solution

Hey Adam,

 

you didn't respond to my post

"If DWGCONVERT not works, you can use a script and a way to run this tool in "all" drawings."

 

 

Now, I tested and it works without a problem.

Nice side effect, you can also clean up your files at the same time, lol.

 

So, if asnyone don't like to use 3rd Tools/Code or is using AutCAD LT older than 2024:

 

DWGCONVERT from Acad would open each file visible on screen and prevent you from using the program in parallel,

I prefer to install DWGTRUEVIEW (what everyone should have for batch format convert jobs)

and run DWGCONVERT from there.

 

Setup an IN-PLACE - file overwrite  conversion setup and rock on.

Sebastian

0 Likes
Message 16 of 17

canadamcadusa
Explorer
Explorer

" REGENALL updated FIELDs, always has." 

this would allow me to then save the drawings. 

 

"and when you OPEN a DWG file, the FIELDs are updated as well."

You are correct, but SAVEALL won't do anything at this point. I would have to REGENALL first, then SAVEALL would work. .

 

0 Likes
Message 17 of 17

canadamcadusa
Explorer
Explorer

"Setup an IN-PLACE - file overwrite  conversion setup and rock on."

I didn't read to the end to see this at first and fumbled around with it, found it in the end and then thought about coming here to mention it, only to see it at the bottom or your response lol.... 

This worked really well actually, and does have some added benefits like purging and other nice file maintenance aspects to it as well. 

Thank you very much for the great idea.  

0 Likes