AutoCAD 2004 Customization Tutorial: Setting Up
a Drawing with a Script
By Alireza Parsai,
June 2, 2003

Scripts are text files that contain a series of AutoCAD
commands. The scripts can be used to setup a drawing and/or
building slide shows. The file name extension for script files
is SCR. You can define a script file with Notepad or any other
text editor. Later the SCRIPT command is used to load and run
the script in AutoCAD window. Let's define and use a script to
setup a drawing. The following layers should be created [Figure
1]:

Figure 1 -
Click on image to enlarge
1. Start AutoCAD 2004.
2. In command line enter layer (or la) to start the command
line version of LAYER command. Answer the prompts as follows.
Note: Boldface texts refer to user entry. The
8
symbol is equivalent to pressing Enter.
Command:
-la8
-LAYER
Current layer: "0"
Enter an
option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
p8
Enter a plotting
preference [Plot/No plot] <Plot>:
n8
Enter layer name(s) for this plot preference <0>:
08
Enter an
option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
n8
Enter name list for new layer(s):
Doors, Walls, Centerlines8
Enter an
option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
c8
New color [Truecolor/COlorbook] <7 (white)>: 108
Enter name list of layer(s) for color 10 <0>: Doors8
Enter an
option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
c8
New color [Truecolor/COlorbook] <7 (white)>: t8
Red,Green,Blue: 20,82,1138
Enter name list of layer(s) for color 20,82,113 <0>: Walls8
Enter an
option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
c8
New color [Truecolor/COlorbook] <7 (white)>: co8
Enter Color Book name: pantone8
Enter color name: 14-6327 tc8
Enter name list of layer(s) for color PANTONE 14-6327 TC <0>:
Centerlines8
Enter an
option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
l8
Enter loaded linetype name or [?] <Continuous>: center8
Enter name list of layer(s) for linetype "CENTER" <0>:
Centerlines8
Enter an
option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
lw8
Enter lineweight (0.0mm - 2.11mm): 0.358
Enter name list of layers(s) for lineweight 0.35mm <0>: Doors8
Enter an
option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
lw8
Enter lineweight (0.0mm - 2.11mm): 0.608
Enter name list of layers(s) for lineweight 0.60mm <0>: Walls8
Enter an
option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
lw8
Enter lineweight (0.0mm - 2.11mm): 0.258
Enter name list of layers(s) for lineweight 0.25mm <0>:
Centerlines8
Enter an
option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:8
3. In command line type
Notepad.
4. Press Enter twice to start Notepad.
5. In Notepad window type the
forgoing user entry sequence [Figure 2].

Figure 2
Notes:
► Script files use the command line version of commands.
Therefore you do not need to precede LAYER with a hyphen (on the
first line).
► In script files both blank spaces and starting new lines are
equivalent to pressing Enter.
► You should insert an extra blank line at the end of file to
exit the LAYER command.
6. Save the file as "Setup.scr" in My Documents or any folder in
AutoCAD file search path.
7. In AutoCAD command line type
SCR and then press Enter. The Select Script File dialog
box appears [Figure 3].

Figure 3 -
Click on image to enlarge
8. Locate and open "Setup.scr".
9. Invoke LAYER command. The
layers are created [Figure 4].

Figure 4
10. Close the dialog box.
11. Close AutoCAD without saving
the drawing file.
12. In Windows desktop Ctrl+drag
the AutoCAD 2004 icon to create a new shortcut.
13. Press F2 and then rename the
new shortcut to "AutoCAD 2004 Custom Layers" [Figure 5].

Figure 5
14. Right-click on the icon. From
shortcut menu select Properties.
15. At the end of Target
edit box add /b setup [Figure 6]. This will call the "Setup.scr"
when you start AutoCAD.

Figure 6
16. Click OK.
17. Double click the new shortcut
icon. A new drawing will open in AutoCAD. The drawing contains
the custom layers.
Note: For more information
about command line switches read the following tutorial:
About the Author
Alireza Parsai is the founder of cadpanel.com. He is a
mechanical engineer with more than 12 years experience with
AutoCAD. Alireza is an Autodesk Authorized Author, the AutoCAD
consultant for Al Khawarizmi Institute, a contributing editor
for Augiworld magazine, a writer for CAD Digest, an instructor
for AUGI Training Program, and an elected speaker for Autodesk
University 2002. He has written 7 books in Farsi, 3 booklets in
English, and more than 30 articles for different magazines and
newsletters. You can reach him at
alireza.parsai@cadpanel.com or visit his website
www.cadpanel.com.
|