This was originally posted over at theSwamp.org.
Using nothing more than a custom partial menu and OpenDCL!
Warning: this is a batch processing program that opens, modifies and closes drawings without giving you the opportunity to interact. So before trying it out, set up a test folder with a few drawings in it.How to use:
Unzip the files to a folder, making sure it's in AutoCAD's search path. Menuload the partial menu, Batch.mns. Now for some reason the menuload command doesn't load the corresponding .mnl file so you'll have to open up a fresh drawing to load the BatchProject.lsp. Yes, this could also be done with an acadDoc.lsp in lieu of the menu.
The calling command is "Batchthis".

The BatchProject.lsp file is pretty well documented (well extremely well documented for me!) so I won't go into much detail here. The Batch.odcl file is the OpenDCL project definition file that is edited in the studio editor. Batch.lsp is the compiled code that I cut and paste into BatchProject.lsp. Now you can just use the Batch.lsp in the Studio Editor and do away with the Batch.odcl, but I like to keep them separate. Why? well, once I accidental screwed up the OpenDCL lisp file in the VLIDE editor. :oops:
The place in the lisp that you'll add the code that modifies the drawing is here:
(defun Batch:Process (/ )
(dcl_Control_SetCaption
Batch_00_DWGName
(strcat "Processing " (getvar "dwgname"))
)
;run the process here - put your edit functions here
(command "circle" "0,0,0" "50")
;close the document
(command "close" "n")
(princ)
(princ)
)
You'll see that I use nothing fancy, just some command calls. You can add any type of lisp stuff. I'm going to set up some subs and just call them here like: (kb_EditTitleBLock) - stuff like that.
You'll also notice I just use (command "close" . . . ) to close the document. This is a beta because I want to speed things up by processing all the drawings first and then use (vla-close to save and close all the processed drawings. I haven't figured out haw to not close the calling document yet - but I'm working on it.
Well, have at it and let me know what you think.
jb