AutoCAD 2004 Customization Tutorial: Custom Hatch Patterns,
Part 1
June 24, 2003
Hatch patterns are defined within text files.
There are two default hatch pattern files, acad.pat and
acadiso.pat. The files are used for Imperial and Metric drawings
respectively. You can add your custom hatch pattern definition
to any of these files or define a custom hatch pattern (PAT)
file. Every custom pattern file can define a single hatch
pattern. The name of hatch pattern file should be similar to the
name of the pattern.
You should be familiar with defining simple
linetypes to be able to define hatch patterns effectively. For
more information please read the following tutorial:
►
AutoCAD 2004 Customization Tutorial: Simple Linetypes
1. Download
R16_custom_hatches.dwg.
Note: If you are using an earlier release of AutoCAD
download
R15_custom_hatches.dwg.
2.
Open the file in AutoCAD. It contains some simple drawings
[Figure 1]. Make sure the "Shield Hatch" layer is the current
layer.

Figure 1
3. In
command line type Notepad and press Enter twice. The Notepad
window will appear.
4. In
Notepad window enter the proper text [Figure 2].

Figure 2
Notes:
-
The first line is a comment line. The lines that
start with a semicolon are ignored.
-
The second line is the header line for the
pattern definition. The general syntax is:
*pattern-name, description
-
The third line uses the following syntax to
define a hatch pattern line family:
angle, x-origin, y-origin, delta-x, delta-y, dash1, dash2,
-
Angle is declared in degrees and defines the
angle of the line family with respect to the current UCS
horizontal direction. Here the angle is equal to 45 degrees.
-
x-origin and y-origin specify the start point of
the first line in the line family.
-
delta-x defines the offset of the line segments
in the line direction. This value is usually set to zero.
-
delta-y defines the family offset value
perpendicular to line direction. Here this value is equal to
0.25 units.
-
dash1, dash2, define the linetype settings.
Here the linetype consists of 0.25 units dashes and 0.1 units
spaces.
5.
Save the file as "glass.pat" in AutoCAD search path. The name of
the file should be the same as the name of the pattern.
Note: If you are not familiar with AutoCAD search path
read the following tutorial:
►AutoCAD
2004 Customization Tutorial: Search Paths
6. In
AutoCAD invoke BHATCH command. The Boundary Hatch and Fill
dialog box will appear [Figure 3].

Figure 3 -
Click on image to enlarge
7.
Select Custom type hatch pattern and then click the button
beside Custom Pattern dropdown list. The Hatch Pattern
Palette dialog box will appear [Figure 4].

Figure 4
8.
Select the custom hatch pattern and then click OK.
9.
Fill in the big closed area with this pattern [Figure 5].

Figure 5
10.
From the layer list select "Frame Hatch" as the current layer.
11.
Invoke Notepad again.
12.
Enter the following text in Notepad window [Figure 6].

Figure 6 -
Click on image to enlarge
Notes:
-
Here the line family consists of 4 lines. The
lines are parallel and they are offset 0.1 units from each
other. Since the offset value is 0.1 and perpendicular to the
line direction the coordinates of origins should be calculated
with the help of a scientific calculator. You may also draw a
line that starts from 0,0 and then offset it 3 times with 0.1 as
offset value. The ID command extracts the location of start
points for all lines.
-
The lines are continuous so you need to define a
dash only. Here the length is set to 1. You may enter any other
value as the length of the dash.
13.
Save the file as "rubber.pat" in AutoCAD search path.
14.
Fill in the small closed area with the new hatch pattern [Figure
7].

Figure 7 -
Click on image to enlarge
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.
|