About Hatch Pattern Definitions and Custom Hatch Patterns

Hatch patterns are defined in one or more definition files that have a .pat file extension. You can use the hatch patterns as they are, modify them, or create your own custom hatch patterns.

Regardless of where a definition is stored, a custom hatch pattern has the same structure. It has a header line with a name, which begins with an asterisk and is no more than 31 characters long, and an optional description.

*pattern-name, description

a pattern definition also has one or more line descriptors of the following format:

angle, x-origin,y-origin, delta-x,delta-y,dash-1,dash-2, …

The standard hatch pattern ANSI31 looks like:

and is defined as follows:

*ANSI31, ANSI Iron, Brick, Stone masonry
45, 0,0, 0,.125

The pattern name on the first line, *ANSI31, is followed by a description: ANSI Iron, Brick, Stone masonry. This simple pattern definition specifies a line drawn at an angle of 45 degrees, the first line of the family of hatch lines is to pass through the drawing origin (0,0), and that the spacing between hatch lines of the family is to be 0.125 drawing units.

Hatch pattern definitions follow these rules:

Note: A blank line must be placed after the last hatch pattern definition in a PAT file. If a blank line is not placed after the last hatch pattern definition, the last hatch pattern definition will not be accessible when using the hatch pattern file.

The process of hatching consists of expanding each line in the pattern definition to its infinite family of parallel lines. All selected objects are checked for intersections with any of these lines; any intersections cause the hatch lines to be turned on and off as governed by the hatching style. Each family of hatch lines is generated parallel to an initial line with an absolute origin to guarantee proper alignment.

If you create a very dense hatch pattern, the program may reject the hatch and display a message indicating that the hatch scale is too small or its dash length too short. Change the maximum number of hatch lines by setting the MaxHatch environment variable to a whole number between 00 and 10000000 (ten million):
  • In AutoCAD LT, use SETENV and enter a valid number.
  • In non-LT products, use the AutoLISP expression (setenv "MaxHatch" "n") where n is a valid number.
Note: In either case, when changing the value of MaxHatch, you must enter MaxHatch with the capitalization as shown.