Updated for AutoCAD 2000!

14. Creating a Hatch Pattern, Part 3

by Ralph Grabowski

Last lesson, we dug into the contents of the Acad.Pat file to get a better understanding of how a pattern is constructed. A reader made this request, which relates to hatch patterns:

To show the problem, I added a hatch pattern (called "Dummy") to the Acad.Pat file, using a text editor such as NotePad. When I started the BHatch command, the "Dummy" pattern name appears but the graphical display area is blank. The problem we here is how to make the pattern appear in the preview area.

There are two stages to solving the problem: (1) create a slide file from the hatch pattern; and (2) integrate the slide file into the Acad.Slb file.

Stage 1: Creating a Slide from a Hatch Pattern

As the reader noted, instructions for creating a graphical preview of hatch patterns are: (1) well- hidden in the AutoCAD documentation; and (2) not at all obvious. The only statement I could find in the hatch documentation reads,

Here's how I created an "icon" from a hatch pattern:

CAUTION:
The SlideLib.Exe utility included with AutoCAD may contain a bug
that prevents it from appending SLD slide files to an existing SLB slide library file.
A work-around is described in #20, Miscellaneous Bits.

Step 1: Start any version of AutoCAD.

Step 2: AutoCAD requires that the icon image have an aspect ratio of 3:2. Autodesk recommends that I use a paper space viewport, because that restricts the MSlide command to taking a "snapshot" of the viewport, not the entire drawing screen. For these two reasons, I typed the following commands to set up the screen:

Command: Tilemode 0 
Command: MView 0,0 3,2 
Command: Zoom E 
Command: Rectang 0,0 3,2

The Tilemode 0 command turns off Tilemode (to allow paper space viewports). The MView 0,0 3,2 command creates a viewport with the 3:2 aspect ratio. The Zoom Extents command makes the viewport fill the drawing screen to maximum size. And the Rectang 0,0 3,2 command draws a boundary for the hatch pattern.

Step 3: I can now use the BHatch (or Hatch, in earlier versions of AutoCAD) to hatch the rectangle.

Command: BHatch

If at all possible, I use a Scale of 1.0; this lets me see the hatch pattern's size relative to other hatch patterns. I only use a larger or smaller scale if I cannot see a representative sample of the pattern. When I scroll the list of hatch patterns in the Boundary Hatch dialogue box, I see some hatch patterns icons with an asterisk ( * ) in the upper-left corner, such as pattern AR-B816. This indicates a hatch icon drawn at a scale other than 1.0. You may want to adopt the same standard for yourself.

Step 4: Switch back to model space before making the slide:

Command: MSpace

Step 5: Finally, I create the slide file:

Command: MSlide

The MSlide command displays the Create Slide File dialogue box. Type the same name as the hatch pattern, such as Dummy.Sld. Then click the OK button.

Step 6: (Optional) When my hatch pattern disappears with the dialogue box, I use the Redraw command to bring it back:

Command: Redraw

Step 7: (Optional) When I have more than one hatch pattern to make slides of, I switch back to paper space before employing the HatchEdit command:

Command: PSpace 
Command: HatchEdit

Then switch back to model space and retake the slide.:

Command: MSpace 
Command: MSlide

When this gets tedious, I create a Script file or Toolbar macro to automate the process. The Script file looks like this:

PSpace HatchEdit Last MSpace MSlide Redraw

And the Toolbar macro looks like this:

\3\3\3PSpace HatchEdit L MSpace MSlide Redraw

Now that I have created one (or more) slide files, it's time to add them to the Acad.Slb or Aclt.Slb (master slide library) file.

Stage 2: Updating the Acad.Slb File

The program that collects individual SLD (slide) files into an SLB library file is called SlideLib.Exe. If you are running AutoCAD under Windows, you'll be in for a rude shock here: you must switch to DOS to use SlideLib; Autodesk simply hasn't gotten around to "window-izing" this utility program. You cannot run SlideLib from the Windows File Manager because the program expects parameters on the command line -- something only a DOS power user could love.

(If I have more than one SLD slide file, I need to create a list of names in yet another file. Here's what's involved:

dummy.sld

Step 1: Switch to DOS by double-clicking the MS-DOS icon.

Step 2: Go to the folder where the SLD files are:

C:\> cd \autocad 2000

Step 3: STOP! A bug in some versions of SlideLib causes it to replace the entire SLB file with your single SLD file, instead of adding the slide. For this reason, copy the Acad.Slb (or AcLt.Slb) file to another subdirectory.

Step 4: Run the SlideLib program. There a couple of different ways to do this, depending on the version of AutoCAD. (Notice that the name of the AutoFCAD LT's master slide library file is called AcLt.Slb):

C:\autocad 2000\> slidelib aclt < dummy.sld

These hieroglyphics mean that I want the SlideLib program to take the Dummy.Sld slide file and add it ( < ) to the Aclt.Slb slide library file. And if you have that list of slide files, you would type:

C:\autocad 2000\> slidelib aclt < sld-list.txt

Step 5: The only indication SlideLib gives you whether it was successful is this data:

SLIDELIB 1.2 (3/8/89) (C) Copyright 1987-89 Autodesk, Inc. All Rights Reserved

If there was an error, it'll be reported, such as:

No library file name specified. The call is: SLIDELIB libname <filelist

Step 6: Exit DOS back to Windows, if necessary:

C:\autocad 2000\> exit

Step 7: Check that SlideLib did it job by starting the BHatch command in AutoCAD.

It's Tedious Work

After learning the process, our reader responded:

There are some third-party applications that apparently are able to automate the process of adding hatch patterns to the Acad.Slb file. You may want to search the Autodesk Web site for these.


Tailoring AutoCAD Part 13 | Part 14 | Part 15 is the next tutorial.

Comments on this tutorial series? Tell me about it.

Return to home page.

All contents copyright 1995-9 XYZ Publishing, Ltd. . All rights are reserved. No material may be reproduced electronically or in print without written permission from XYZ Publishing, PO Box 3053, Sumas WA, 98295-3053, unless otherwise noted.