How to make custom hatch pattern in AutoCAD

Generally, to fill an area with a pattern hatches are used and there are plenty of ready-made hatch patterns available in AutoCAD but if you want to use your own custom hatch pattern then you can make it using a type of simple code and also using an express tool called Superhatch.

In this article, I have explained both the methods in detail including the process of transferring hatch pattern from one drawing to other.

Making hatches using Superhatch is pretty easy and it does not need any kind of code but you won’t be able to transfer these custom hatches from one drawing to other which might be very limiting for most of the uses.

On the other hand, you can easily transfer hatches made with “hatch code”. To begin with, I will explain making custom hatch pattern using hatch code than about Superhatch tool.

But if you don’t feel like reading the article you can watch this video as well which explains both the methods.

Now the article continues.

Making Hatches using “Hatch Code”

In this case, I will make this simple stair type hatch pattern using the “hatch code”.

So, to do this open Notepad (or any other Unicode text editor if you want) and type the following lines.

*TESTHATCH, Our test hatch with the staircase effect

0, 0,0, .2,.2, .2,-.2

90, .2,0, .2,.2, .2,-.2

These lines will actually make the pattern which you see in the image above. After adding these lines in the text editor save it as a PAT file using the same name defined in line 1 of this code.

In this case, you need to save the file as TESTHATCH.PAT, if you keep a different name for the PAT file then the custom hatch pattern will not work.

Let’s deconstruct these lines and to simplify this I have colored the horizontal segment Red and vertical one Green.

Now, let’s move back to the Hatch code which I just showed you above. The complete code has three lines with characters in each line separated with commas.

Every set of character inside comma has its own meaning and all of these lines will add up to make the complete pattern. In this case, line 1 will determine name and description of hatch pattern, line 2 is for the horizontal segment of the hatch and line 3 is for the vertical segment.

Line 1: *TESTHATCH, Our test hatch with the staircase effect

In this line, the hatch code starts with a star sign followed by the name of the hatch in uppercase. Then we have a description for the hatch separated by a comma. So, essentially the hatch code should start with star sign then name and then description all separated by a comma.

Line 2: 0, 0,0, .2,.2, .2,-.2

The line 2 is for the Red line shown in this image.

Here the first character 0 is for the angle which is 0 degrees which makes the line horizontal.

The second and third characters 0,0 are coordinates of the starting points of the horizontal line. In this case 0,0 is not the absolute coordinate rather its an origin assigned by hatch pattern for that particular pattern only.

The next characters .2,.2 are for the starting point on the next set of the horizontal line with respect to the origin set for the first point.

The last two characters .2,-.2 are for the length of the line segment and gap length. The length of the segment is shown as .2 (positive value) and the gap is shown as -.2 (negative value) unit.

If you are familiar with making custom linetypes in AutoCAD then you will notice that this hatch code is quite similar to the linetype code for custom AutoCAD linetypes.

Line 3: 90, .2,0, .2,.2, .2,-.2

The line three is for the green lines as shown in the image below.

Here the first character 90 is for the angle of the line which you can see that, in this case, is vertical or at an angle of 90 degrees.

The second set of characters .2,0 are the coordinates of the starting point of the first green line towards lower left column and this coordinate point is with respect to the origin defined in line 2 of the hatch code, which for this case is the starting point of the first red line as shown in the image 3 above.

The third set of characters .2,.2 is once again the offset value of 90-degree line along X and Y axis or the displacement of the next set of the vertical line along X and Y axis and its in this case again 0.2 units.

The last set of characters .2,-.2 are once again the length of the vertical segment and the gap of the segment. The positive value is for the length and negative value is for the gap.

Getting the complete hatch pattern

As you just now saw that each line has its own role in making the complete hatch pattern and you can add even more lines in this code that will eventually add up to make a complete pattern. So, in a nutshell, each line of the hatch pattern code will make a set of similar parallel lines which end up giving a pattern shape.

There are also some finer details related to making hatch pattern that you need to take care of like you need to add at least one blank line at the end of the hatch code in order to make the hatch code work. Also, you need to ensure that the hatch pattern name defined in the code and name of PAT file should be the same. More can be seen in this Autodesk knowledge network article.

Using and Transferring Hatch Patterns

To use this hatch pattern in the drawing you need to copy the PAT file in the support folder. To find the location of support folder type OP and press enter. Then select the file tab and expand the “Support File Search Patch” tree and there you will see the location of the support folder.

I have marked the support folder for my PC in this image in the red box.

To transfer the hatch pattern to other PC all you need to do is just copy paste this custom PAT file in the support folder of PC where you want it to transfer.

Alternatively, you can also add a location to this list of support files and then save all your custom hatch patterns in that folder. This method has been explained in the video above.

Making Hatches using Superhatch

Hatches work the way that fonts do, as vector images. Under normal circumstances, you cannot upload image files and identify them as a Hatch. Instead, you must make a text file with specific coding but with superhatch, you can even make hatches with images.

Super Hatches, as the name would imply, allow you to go above and beyond when creating hatches. In the SUPERHATCH command, there are 5 options. We will learn how to use the first three.

From Block Option

We are going to make a Hatch Pattern from an AutoCAD block. This can be done with any 2D block in AutoCAD.

Make a Pattern within the circle that’s in our AutoCAD drawing. It can be any sort of Pattern, I made one like this.

 

The next step is to make a rectangle in which we will apply the hatch. For this next part, there are a lot of steps involved, so pay close attention.

First, type BLOCK in the Command Line, and hit ENTER to open up the Block Window. In the Block Window, Click “Pick point” and then click the bottom-most point of our circle marked in the red oval in the image below.

Where it says “Name” in the Block Window, give your Block a name. It can be anything you like, as long as you can remember it. I’m naming mine “Pattern for Hatch Tutorial”.

Next, in the Block Window, Click “Select objects” and highlight the entirety of our circle pattern.

Following that, you can click OK at the bottom of the Window to close it.

Those steps were pretty standard. We were just making our pattern into Block. The following steps are where we make our Block into a Hatch.

If you have Express Tools, you can go to the Express Tools Tab in the Ribbon and click the Super Hatch icon. If you don’t have Express Tools, you can just type SUPERHATCH instead in the Command line, and then hit ENTER. Express tools or SUPERHATCH command is not available in AutoCAD LT.

In the Super Hatch Window, Click “Block…”. After that, Click “OK” in the next Window.

The next step is to click anywhere within the now empty rectangle at the center of our drawing.

The command dialogue will ask about x-scale. Type 0.5 and hit ENTER. Hit ENTER once again to apply the same scale to the Y-axis. Hit ENTER repeatedly until you get to the part about “Specify Block [Extents]”

Inside our rectangle will be a smaller version of our Block, with a magenta rectangle bordering that block. Click the bottom-left point of that magenta rectangle. After that, click the top-right point of that magenta rectangle. Then, hit ENTER and click again anywhere inside the rectangle where you want to make the hatch and hit ENTER one final time.

Your final result should look something along these lines.

From Image Option

Making an image into a Hatch isn’t always so practical, but if necessary, it is possible.

We will be using this image wrinkled paper image. You can download this image by right-clicking and selecting “save image as” option from the contextual menu.

Save it to your computer as WrinkledPaper.jpg.

Back in AutoCAD, make a rectangle with a line passing vertically through its midpoint. We will be Super Hatching that rectangle with our image.

Load up the SUPERHATCH Command and Select “Image..” from the Super Hatch Window.

In the Windows Explorer Window that pops up, locate the image you saved of the Wrinkled paper, select it, and click “Open”.

Click “OK” in the following window.

Following that, the AutoCAD command line will ask you to select an insertion point. Click the bottom-left corner of the left rectangle in our drawing.

Next, AutoCAD will want you to pick a Scale Factor for the insertion. It usually takes a couple tries to figure out the best size. Through trial and error, I found that it was best to use a scale factor of 50.0 in my case, in your case it could be different.

Type 50.0 in the command line and press ENTER. Hit ENTER once again to agree that you find the placement acceptable. Next, the dialogue will ask you to pick internal points. Click the border of the rectangle. Half will be selected. It will be highlighted. Your rectangle should look similar to Figure below.

Hit ENTER one final time. Your rectangle should now look like Figure below.

What is really special about Image Hatches is you can individually select each tile and delete it or resize it if you like.

Updating a Hatch

Create an ordinary Hatch on the on the opposite of the rectangle and then delete the vertical line separating the Image Hatch from the Pattern Hatch. Now, if you delete Image Tiles bordering the Pattern Hatch, and then Hatch the empty spaces, it will update our previous Pattern Hatch to encompass the new area.

You will notice white lines bordering the Image Tiles. If you want to get rid of these, doing so is quite simple. Just type IMGFRAME into the Command Line and hit ENTER. Then type 0, and again, hit ENTER.

The image attached in this hatch will behave like an Xref and if you delete the original image then hatch will also disappear leaving only rectangular boundaries instead of image grids.

From Xref Attach

Xrefs are External References. To make an External Reference into a Hatch, you simply make a Hatch design in another drawing and then save the drawing. Following that, use the SUPERHATCH command, pick “Xref Attach…” from the Super Hatch Window. In the Windows Explorer Window that appears, pick the Hatch drawing you created. All you have to do after that is pick an insertion point and hit ENTER.

Conclusion

As you just saw that AutoCAD is quite flexible to allow you to make hatch pattern directly using Superhatch and also with hatch code. Both the methods can be used to make hatches but the hatch code offers you more flexibility as the patterns can be transferred easily and can be customized by changing just a few lines in the hatch code.

Which of the methods did you use often or planning to use for making custom hatches? Don’t forget to let me know in the comments below.

This is a guest post by Ben Richardson of Acuity training, you can share your own guest articles as well.

2018-12-12T23:58:52+00:00

About the Author:

Ben Richardson is a director of Acuity Training. Acuity Training is based in Guildford, UK and provides classroom-based IT training on packages including AutoCAD, Adobe and Microsoft Office. He’s a recent to convert to CAD but is an engineer at heart, having studied materials science at Cambridge University, UK.

6 Comments

  1. Dayananda November 26, 2018 at 1:58 pm - Reply

    Very Useful Indeed! Thank You

  2. dhillipabi November 23, 2018 at 1:07 pm - Reply

    It’s really nice work

  3. Umesh tripathi November 20, 2018 at 2:18 pm - Reply

    Sir please provide vedio about this topic because in written pattern not understanding properly.

  4. Kyaw Zin November 20, 2018 at 5:35 am - Reply

    Nice work! Can I use alphabets in custom hatch pattern?
    So that hatching may result in alphabetical pattern.
    Thanks a lot.

  5. Maria November 20, 2018 at 12:32 am - Reply

    When would one use an image as a hatch?

  6. Mintu November 19, 2018 at 10:53 pm - Reply

    Amezing Very nice tutorial indeed …………………..
    Thanks a lot

Leave A Comment