Introduction to AutoCAD Script Files

Although each release of AutoCAD translates to bigger and arguably better features one thing has never changed; its malleability. In fact some would argue the malleability of the software as being its best feature. Be it the CUI command, LISP routines, or even VBA and .NET applications. Each of these features is included in the software for one reason – user customization. Even still, LISP and .NET customization can be rather illusive for all but a small minority of the AutoCAD user base.

An Easy Path to Customization

Luckily script customization affords even rookie AutoCAD users a way to automate AutoCAD with endless possibility. While I know the sheer term “Script File” intimidates many, but truth be known, you’ve been writing script files for as long as you have been using AutoCAD. So how is that possible? Well, an AutoCAD script file is really nothing more than a sequence of standard AutoCAD Commands. Thus if you know how to type commands at the command line, you know how to write a script file.

Scripting Commands with Dialog Boxes

Let’s take a look at how we might create a script file which creates a new layer named C-ROAD-TEXT, sets its color to Yellow, and then sets the layer current.

The LAYER command is among a growing number of AutoCAD Commands which have both a dialog box version and a command line version.  By default, AutoCAD uses the dialog box version of a command.  While this is great for general usage, script files have no way to interact with dialog boxes.  For this reason, we must explicitly tell AutoCAD to use the command line version of a command.  Generally, this can be done by prefixing the command name with a hyphen (-).  Consequently, rather than typing LAYER which opens the Layer Manager Dialog, we will need to type -LAYER.  This will suppress the dialog, and present the entire command at the command line.

Read moreIntroduction to AutoCAD Script Files

Creating AutoCAD Script Files with Excel

image Script files seem to be one of the many forgotten frontiers of AutoCAD.  “Back in the day” I knew of many CAD users who couldn’t go a day without running a script file or two.  These days – not so much.  Even still, the trick of yesterday can still help solve many tedious and mundane tasks today.

So what is an AutoCAD script file?  Quite simply a script file is a batch file for AutoCAD.  Windows batch files carry the BAT extension, whereas an AutoCAD script file carries a SCR extension.  The power of AutoCAD script files is in their simplicity.  Look under the hood, and they are nothing more than an ASCII text file containing an AutoCAD command on each line.

Read moreCreating AutoCAD Script Files with Excel