[Search tip detail and code files using keywords, tip number, author name, etc ]
 
Use ScriptPro to Edit Multiple Drawings in a Batch Process
Tip# 4421 By Michael Partenheimer On 02-Feb-2015
4
Rated By 1 users
Categories : Script Files
Software type : AutoCAD 2015
Rename File To : No Files to download.
Download this free tool from AutoCAD to make the same modification to many drawings.

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.

 

Average Rating:
4


User comments
Comment by Peffer,Barry
Posted on 2015-03-12 15:02:13
We use scriptpro to manage a wiring schematic database. We can attach and detach xrefs as well. You can use some commands by using the shortcut hot key, but some must have the whole command typed. You usually have to turn off dialog boxes and ortho at the beginning of the script, and you can also do a purge, zoom all and quicksave at the end. That is very nice. We test by copying the script from notepad into the command line. Be careful- sometimes the script doesn't work the same pasting it in as it does when running scriptpro. That has bit me a couple times.