AutoCAD · Hatch
Whether you’re showing a cross-section on a mechanical drawing or differentiating wall materials on an architectural plan, Hatch is the tool that gets the job done. The command itself is straightforward — but in practice, you’ll often run into that frustrating “Unable to determine valid boundary” error and wonder where things went wrong.
“From pattern selection and scale settings to tracking down boundary errors — everything you need to know about AutoCAD Hatch, all in one place.”
In this post, we’ll walk through the basic Hatch workflow, pattern types and scale/origin settings, how to diagnose and fix boundary errors, and tips for editing hatches after the fact — step by step.
1. Hatch Basics (HATCH · Shortcut: H)
The Hatch command fills a closed area with a repeating pattern or solid color.
- Basic usage: H → Enter → Pick a pattern from the ribbon → Click inside the area you want to fill → Enter
- Pick Internal Point: The most common method. Click anywhere inside a closed area and AutoCAD automatically detects the boundary and fills it with the selected pattern.
- Select Objects: Manually select the objects that form the boundary (polylines, circles, etc.). Useful when the automatic boundary detection isn’t cooperating.
2. Hatch Patterns and Scale Settings
When you run the Hatch command, a “Hatch Creation” tab appears in the ribbon. This is where you control the pattern, scale, angle, and more.
2-1. Common Pattern Types
- ANSI31: 45-degree diagonal lines. The go-to standard for cross-sections in mechanical drawings.
- ANSI32: Wider-spaced diagonal lines than ANSI31 — good for larger areas where ANSI31 looks too dense.
- ANSI37: The standard pattern for representing cast iron sections.
- SOLID: Fills the area completely with a solid color. Great for emphasizing cut faces or color-coding regions.
- ISO patterns: Based on ISO standards — commonly used in metric drawings.
2-2. Adjusting the Scale
Scale controls how tightly or loosely the pattern lines are spaced.
- Scale too small: The lines pack together so tightly the hatch looks like a solid black fill.
- Scale too large: The spacing gets so wide that the hatch appears empty — like nothing was applied at all.
- The right scale depends on your drawing’s units and plot scale, so use the preview to dial it in before confirming.
If your hatch fills the entire area with solid black, or shows nothing at all, the Scale value is almost certainly the culprit. For example, if your drawing is in millimeters and the scale is set to 1, the pattern lines are just one millimeter apart — way too tight, so it looks black. Try bumping the scale up to somewhere between 10 and 50. Conversely, if the scale is too high, the pattern lines are so far apart that none of them fall inside the area — bring it back down.
2-3. Setting the Origin
The origin defines where the hatch pattern “starts” from. By default, it uses the UCS origin (0,0) — but for patterns like brick or tile where alignment to a specific point matters, you’ll want to change it.
- In the ribbon’s “Origin” panel, click “Set Origin” and pick any point in the drawing to use as the new starting position.
- You can also choose from predefined positions like bottom-left, bottom-right, or center of the boundary.
3. Pattern Hatch vs Gradient Hatch
| Feature | Pattern Hatch | Gradient Hatch |
|---|---|---|
| Appearance | Repeating lines or shapes (diagonal, crosshatch, etc.) | Smooth color transition between two colors |
| Primary use | Cross-sections, material callouts (mechanical & architectural) | Visual depth in presentations and diagrams |
| Settings | Pattern type, scale, angle, origin | Start/end colors, gradient direction (linear/radial) |
In day-to-day mechanical drafting, you’ll use pattern hatch almost exclusively. Gradient hatch is more of a presentation tool — something you’d see in a rendered diagram or sales drawing, not a production drawing.
4. Boundary Errors — What’s Going Wrong and How to Fix It
You click inside what looks like a perfectly closed area, and AutoCAD throws back an “Unable to determine valid boundary” error. Nine times out of ten, the area isn’t actually closed — but there are a few other sneaky causes worth knowing about.
4-1. Tiny Gaps in the Boundary (The Most Common Cause)
The boundary looks solid from a normal zoom level, but when you zoom way in on a corner, there’s a 0.01mm gap between two lines. AutoCAD treats even the tiniest gap as an open boundary — no exceptions.
- Fix 1 — Find and close the gap manually: Zoom in on each corner of the boundary and hunt for gaps. Once you find one, close it with F (FILLET, radius 0) or stretch one of the lines to meet the other using EX (EXTEND).
- Fix 2 — Retrace the boundary with a polyline: If you can’t track down the gap, just trace over the entire boundary with PL (PLINE) and close it explicitly. Use that polyline as your hatch boundary, then delete it when you’re done.
- Fix 3 — Join with PEDIT: If the boundary is made up of separate lines and arcs, try PEDIT → select the objects → J (Join) to merge them into a single polyline. Any segment that fails to join is where the gap is hiding.
4-2. Gap Tolerance (HPGAPTOL)
When tracking down every tiny gap isn’t practical, you can tell AutoCAD to ignore gaps up to a specified size and hatch anyway.
- While the Hatch command is active, increase the “Gap Tolerance” value in the ribbon. (Default: 0)
- Or type HPGAPTOL → Enter → enter the maximum gap size to allow (e.g., 1 or 5)
- Don’t go overboard with this value — set it too high and AutoCAD may bleed the hatch into areas you didn’t intend to fill.
Whatever value you set for HPGAPTOL gets saved with the drawing. If you bump it up to fix a problem and then forget about it, future hatches may behave strangely — picking up areas you didn’t intend because the tolerance is still wide open. Always reset it back to 0 once you’ve sorted the boundary issue.
4-3. Z-Elevation Mismatch
In the 2D view, the lines look like they meet perfectly — but their Z values are actually different. This happens a lot with geometry copied in from other drawings.
- How to check: Select one of the boundary lines and open the Properties panel. Check the Start Z and End Z values.
- Fix: Run the FLATTEN command on the affected objects to force all Z values to 0.
4-4. Duplicate Overlapping Objects
When two or more lines are stacked on top of each other at the exact same position, AutoCAD can get confused trying to read the boundary.
- Fix: Run OVERKILL to clean up any duplicate or overlapping geometry, then try the hatch again.
4-5. Viewport / Zoom Issues
If part of the boundary extends outside the current view — or the zoom level is extremely high or low — boundary detection can fail even if the geometry is perfectly fine.
- Fix: Make sure the entire boundary is visible on screen before running Hatch. Use Z → E (Zoom Extents) to see the full drawing, zoom back in to the target area, and try again.
4-6. Last Resort — Use the BOUNDARY Command
If none of the above works, bring in the BO (BOUNDARY) command. It scans the drawing for any closed region and automatically generates a clean polyline around it.
- BO → Enter → Click inside the area → If AutoCAD finds a closed region, a new polyline boundary is created
- Run your hatch on top of that generated polyline — boundary recognition should work cleanly.
- If BOUNDARY itself fails, that’s AutoCAD telling you the area is genuinely not closed. Time to go fix the geometry directly.
5. Editing an Existing Hatch
Already placed a hatch and need to tweak it? Here’s how.
- Double-click: Double-clicking any hatch object reopens the Hatch Editor ribbon. From there you can freely change the pattern, scale, angle, or any other setting.
- Match Properties (MA): Need to make one hatch look exactly like another? Use MA (Match Properties) — click the source hatch, then the target. The pattern, scale, and angle all copy over in one shot.
- Associative hatch: By default, hatches are “associative” — meaning if you resize or reshape the boundary, the hatch updates automatically to fill the new shape. To break that link, select the hatch, open Properties, and set Associative to “No.”
Hatch Commands at a Glance
| Command | Shortcut | What It Does |
|---|---|---|
| HATCH | H | Fill a closed area with a hatch pattern |
| HATCHEDIT | Double-click | Edit an existing hatch (pattern, scale, angle, etc.) |
| HPGAPTOL | — | Set the maximum gap size AutoCAD will ignore when hatching |
| BOUNDARY | BO | Auto-generate a polyline boundary from a closed region |
| FLATTEN | — | Force all Z values on selected objects to 0 |
| OVERKILL | — | Remove duplicate and overlapping objects |
Wrapping Up
Hatching itself is simple — the trouble is that boundary errors have a way of eating up your time when you least expect it. Here’s the quick troubleshooting checklist to keep in your back pocket:
- Error message? Start by zooming into every corner of the boundary and checking for micro-gaps. Close them with FILLET (radius 0), EXTEND, or PEDIT Join.
- Can’t find the gap? Bump up HPGAPTOL to let AutoCAD skip over small gaps — just remember to reset it to 0 afterward.
- Still stuck? Use BO (BOUNDARY) to generate a fresh polyline boundary and hatch that instead. It’s the most reliable workaround when everything else fails.