Hi,
For me this type of procedure to purge drawings from an entire folder has always worked well.
This purges specific application dictionaries, here for example objects from the COVADIS application (French application) or/and from the Autocad Archictectural application.
This can simply be commented out with a ; at the beginning of the line of the code or adapted according to your needs
He checks the drawing
Purges unused applications for the first time
Purge a 2nd time for all objects
And saves in LT2018 format
All these commands being customizable, the only trick is to remember to double the " with \" between (write-line " ...... "file_scr) compared to a natural lisp writing.
The code can be copied and pasted directly on the command line, preferably from a blank drawing
After choosing a folder, it will automatically create the script (update.scr) and the batch (update.bat) and AcCoreconsole will start its processing.
((lambda ( / f_exe ShlObj Folder FldObj Out_Fld file_scr file_bat)
(vl-load-com)
(setq f_exe (findfile "accoreconsole.exe"))
(setq
ShlObj (vla-getinterfaceobject (vlax-get-acad-object) "Shell.Application")
Folder (vlax-invoke-method ShlObj 'BrowseForFolder 0 "" 0)
)
(vlax-release-object ShlObj)
(if Folder
(progn
(setq
FldObj (vlax-get-property Folder 'Self)
Out_Fld (vlax-get-property FldObj 'Path)
)
(vlax-release-object Folder)
(vlax-release-object FldObj)
)
)
(setq file_scr (open (strcat (getvar "ROAMABLEROOTPREFIX") "support\\update.scr") "w"))
(write-line "((lambda ( / ) (foreach p (entget (namedobjdict)) (if (and (= 3 (car p)) (or (wcmatch (cdr p) \"COVA_*\") (wcmatch (cdr p) \"AEC_*\"))) (dictremove (namedobjdict) (cdr p))))))" file_scr)
(write-line "(command \"_.audit\" \"_Yes\")" file_scr)
(write-line "(command \"_.-purge\" \"_Regapps\" \"*\" \"_No\")" file_scr)
(write-line "(command \"_.-purge\" \"_All\" \"*\" \"_No\")" file_scr)
(write-line "(command \"_.saveas\" \"_LT2018\" \"\" \"_Yes\")" file_scr)
(close file_scr)
(setq file_bat (open (strcat (getvar "ROAMABLEROOTPREFIX") "support\\update.bat") "w"))
(write-line (eval (read "(strcat \"set accoreexe=\" \"\\\"\" f_exe \"\\\"\")")) file_bat)
(write-line (eval (read "(strcat \"set source=\" \"\\\"\" Out_Fld \"\\\"\")")) file_bat)
(write-line (eval (read "(strcat \"set script=\" \"\\\"\" (getvar \"ROAMABLEROOTPREFIX\") \"support\\\\update.scr\" \"\\\"\")")) file_bat)
(write-line "FOR /f \"delims=\" %%f IN ('dir /b \"%source%\\\*.dwg\"') DO %accoreexe% /i \"%source%\\%%f\" /s %script%" file_bat)
(close file_bat)
(startapp (strcat (getvar "ROAMABLEROOTPREFIX") "support\\update.bat"))
(princ"\Job finished")
(prin1)
))