Updated for AutoCAD 2000!

12. Creating a Hatch Pattern, Part 1

by Ralph Grabowski

When Autodesk first introduced hatch patterns to AutoCAD (more than ten years ago in v1.4), the hatch pattern was consisted of three elements: dashes, gaps, and dots. To create a repeating pattern, the pattern definition specifies an offset and angle. During the intervening decade, the only change made by Autodesk was the addition of associativity to Release 13; change the boundary and the pattern automatically updates itself.

In this tutorial, we look at how to create our own hatch pattern and edit existing patters. Even though AutoCAD comes with 67 patterns, your office's drafting standards may require a specific pattern. You may want to edit AutoCAD's Dots pattern because it has a serious problem: pretty much all laser printers cannot plot the dots because they're too tiny (the dots also don't show up in certain drawing translation).

Where Does A Hatch Pattern Come From?

Hatch patterns are defined in a file external to AutoCAD. The file has an extension of PAT. You can have many pattern files, each with an extension of PAT. However, it is easier to keep all patterns in a single file, Acad.Pat. AutoCAD defines its hatch patterns in the \support\Acad.Pat file; versions of AutoCAD prior to R13 have a fewer number of patterns.

No hatch patterns are predefined in a new AutoCAD drawing. For this reason, the PAT file must be loaded into AutoCAD before you can apply the hatching to objects. However, unlike with linetypes, the hatch pattern file is loaded automatically the first time you use the Hatch and BHatch commands.

When AutoCAD applies a hatch pattern to an area, AutoCAD generates an infinite number of parallel patterns from the definition in the PAT file -- the infinite pattern comes to a stop when it reaches a boundary (see figure #1). Once in place, you can use the Move command to move the hatch pattern elsewhere in the drawing (see figure #2).

The pattern consists of only lines, line segments (dashes), dots, and gaps; AutoCAD cannot create hatch patterns made of circles and other non-linear objects. AutoCAD R14 and 2000 also support solid filled areas in any color.

The Hatch and -BHatch commands create hatch patterns at the command line. The BHatch command displays a dialog box.

The Hatch command creates non-associative hatch patterns only. Non-associative means the shape of the pattern's area is fixed; when you change the boundary, the pattern does not change (see figure #3). This is useful when you want the pattern to remain fixed.

The BHatch and -BHatch commands create either non-associative or associative hatch patterns. Associative hatching means the shape of the pattern's area changes as you change the boundary; see figure 4.

AutoCAD treats both kinds of hatch pattern as a block; extended entity data allows the HatchEdit command to change the parameters of the pattern, such as scale, spacing, and pattern name. You can use the Explode command to explode the block into its constituent lines. As an alternative, prefix the pattern name with an asterisk ( * ) and AutoCAD draws the patterns as individual lines, not as a block.

AutoCAD has several system variables that report the most-recent setting of hatch pattern parameters:

Those last two system variables let you control where the hatch pattern begins. Normally, the pattern assumes an origin of (0,0) and an angle of 0 degrees. But if you need to precisely control the placement of the pattern, change the values of SnapAng and SnapBase as required.

Creating Custom Hatch Patterns

AutoCAD has two ways to create a custom hatch pattern: (1) simple patterns at the 'Command:' prompt; and (2) edit the Acad.Pat file with a text editor.

To create the simple hatch pattern at the 'Command:' prompt, you use the Hatch command or BHatch command. Unfortunately, AutoCAD does not save the fruits of your labor. (This is unlike when you create a custom linetype at the 'Command:' prompt with the LType command.) For this reason, think of the first method of creating custom hatch pattern on-the-fly.

Your options for creating a hatch patter on-the-fly are really limited. Here's how to do this with the Hatch command:

1. Start AutoCAD.

2. Type the Hatch command:

Command: hatch

3. Select the User-defined option:

Enter a pattern name or [?/Solid/User defined] <ANSI31>: u

4. Specify the three parameters for the custom hatch pattern. First, the angle. This is measured from the setting of system variable SnapAng (0 degrees, by default, which is in the direction of the positive x-axis). When SnapAng is set to something other than 0, the angle you specify here is added to the value stored in SnapAng.

Specify angle for crosshatch lines <0>: 45

5. Second, the spacing between parallel lines

Specify spacing between the lines <1.0000>: 2

6. Third, decide if you want the pattern double-hatched. That means a second pattern is applied at 90 degrees to the first pattern.

Double hatch area? [Yes/No] <N>: y

7. Finally, you select the object or boundary to hatch. As of R13, there is an option that lets you draw a polyline boundary to contain the pattern, as follows:

Select objects to define hatch boundary or <direct hatch>,
Select objects:: [press Enter]
Retain polyline boundary? [Yes/No] <N>: y
Specify start point: [pick]
Specify next point or [Arc/Length/Undo]: [pick]
Specify next point or [Arc/Close/Length/Undo]: a
Specify next point or [Arc/Close/Length/Undo]: [pick]
Specify next point or [Arc/Close/Length/Undo]: [press Enter]
Specify start point for new boundary or <apply hatch>: [press Enter to apply hatch pattern]

AutoCAD draws the pattern but -- as I mentioned earlier -- your custom hatch pattern isn't saved to the PAT file.

To do the same thing with the BHatch command is a bit different; it's more like filling out a form:

1. Type the BHatch command.

2. When the Boundary Hatch dialogue box appears, select User Defined from the Pattern Type area.

3. AutoCAD allows you to type values for Angle, Spacing, and Double.

4. Click the PickPoints button and select the area you want hatched. AutoCAD automatically creates a boundary, unlike the Hatch command.

5. Click Apply and AutoCAD applies the hatch pattern.

Inthis lesson, we were introduced to hatch patterns and how they work. We created a simple pattern on-the-fly with the Hatch command. In the next lesson, we get out our trusty text editor and dig into the contents of the Acad.Pat file.

Tailoring AutoCAD Part 11 | Part 12 | Part 13 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.