ScriptPro is a very useful tool when you need to make the same modification to many drawings. It’s a free download from the AutoCAD download page: http://autode.sk/1D0OqHd
I once used ScriptPro successfully to automate changes to more than 10,000 project files in a batch process over one weekend. This extreme editing session was accomplished by dividing the files into four lists and using four workstations running the same script starting on Friday evening. It was a life saver.
An AutoCAD script is easy to create. Anything that can be typed at the command line can be run. You can augment your script with AutoLisp functions and variables when a more complex edit is required. Simply create a windows text file and change the extension from TXT to SCR. Enter keystrokes into your script key for key the same as you would enter them at the command line in a live drawing.
Here is a sample script to change layer 0 from white to red:
-LAYER
C
RED
0
<space character>
Your SCR file must contain one — and only one — space character in order to finish out the –LAYER command.
Here is a sample script using AutoLisp to change layer 0 from white to red:
(command "-LAYER" "C" "1" "0" "")
Be certain no space character occurs after or below the closing parenthesis because such a character would repeat a previous entry.
Check the above script(s) by typing each line at the AutoCAD command prompt and view the result of each entry.
Important regarding AutoCAD scripts:
-
Be wary of extra (and invisible to the eye) returns and spaces in any AutoCAD script.
-
Remember that any keyboard character in a script behaves as it would during a live drawing key-in. (A stray space could repeat or end a command unexpectedly.)
-
Be certain to always test your script before batch processing it on many drawings.
Notes from Cadalyst tip reviewer R.K. McSwain: As Michael points out, using ScriptPro can be a huge time saver when you need to make the same change to multiple drawings. However, let me reiterate is his last few points. Test your script over and over until you're sure it's correct, because a misplaced space or typo will cause frustrating errors if you dive right in and try to process multiple drawings before testing. |