Tag Archives: Hatch

AutoCAD 2012 – How to “hatch” using any objects

Here’s a trick you can use in AutoCAD 2012 to fill an area with any objects you like. It’s not actually hatching, but it has several advantages over the real thing:

  • You aren’t restricted to straight line segments as you are with real hatching. Circles, splines, even solid objects, you name it, you can use it.
  • To define the pattern, you don’t have to master an arcane file format or use trigonometry to work out the numbers used in it. Just draw the objects you want repeated.
  • You can easily change the spacing between the objects later, or even change the objects themselves.

How is this done? Use the new associative array feature, then use XClip to restrict the displayed objects to within a specified boundary. For example, let’s say you have a polyline you want filled with green spheres, and a green sphere already drawn. The sequence is:

  • Use the Array command to create a rectangular array of spheres that more than covers the whole area you want “hatched”. You might prefer to use my ClassicArray add-on for this, but it will make no difference to the finished objects.
  • Use the XClip command and select the array of spheres. Press Enter to accept the default option of New. Type S [Enter] to select the polyline, then pick the polyline. Done!

Don’t have a handy polyline defining the area? No problem, just create one before you start using the Boundary command.

There are some restrictions to this technique that do not apply to normal hatching. For example, any arc segments in the polyline will be treated as if they were straight lines, which isn’t very useful. But this method will work in most cases, and it sure beats spending hours trying to get your hatch pattern definition just right. You can even use an array of arrays to get some very interesting effects. For example, you could have a series of circles in a wave-form path array, which is then arrayed in a rectangular form before being Xclipped.

Not using AutoCAD 2012? You can do something similar using Minsert. Instead of Array, use the Block command to convert your objects to a block, then the Minsert command to insert it in a series of array-like rows and columns. Finally, Xclip it as described above.

Edit: In a comment, Patrick Emin reminded me of the Express Tools command SuperHatch. This allows you to use an image, block, xref, or wipeout object as a hatch pattern. It also automatically takes care of various details, including converting arcs within the boundary to straight line segments. However, the end result can be hundreds of individual blocks collated into a group, rather than just one configurable object if you use the Array or Minsert methods I describe above.

Restoring Hatch double-click in AutoCAD 2011

In AutoCAD 2011, the default action when double-clicking on a hatch object is to invoke the Properties palette for that object. In previous releases, it would invoke the Hatch Edit dialog box. In my AutoCAD 2011 – Putting things back to “normal” post, I briefly described how to restore the old double-click action. I have since seen some incorrect advice being given out about how to do this, so this post describes the correct process in full detail.

What to do

  1. Invoke the CUI command.
  2. In the top left pane, find the [+] next to Double Click Actions and left-click on it.
    Double Click Actions
  3. Scroll down that top left pane a little until you can see Hatch.
    Hatch
  4. In the bottom left pane (Command list), click on any command and type H. This should take you down to the Hatch Edit command. If not, just scroll down a little more until you can see it.
    Hatch Edit
  5. Left-click on the Hatch Edit command in the bottom left pane, hold down the mouse button and drag the command up onto the top right pane until it hovers over the Hatch item you exposed in step 3. When the little blue triangle is pointing to Hatch, let go of the mouse button, thereby dropping the Hatch Edit command onto Hatch.
    Drag and Drop
    Hint: you may find that the top left pane scrolls crazily while you attempt this step. Unfortunately, this is a “feature” of the CUI interface. If this happens, keep your mouse button held down and move your cursor up and down in the left pane until the scrolling comes under control and you are hovering over the right spot. You can avoid this if instead of dragging the command directly upwards, you move in a curcuitous route to the left or right, moving on to the top left pane from the side rather than the bottom.
  6. Pick OK and that should be it. Double-click on a hatch object and see what happens.

What not to do

You may see some advice telling you to find the Hatch double-click action (step 3 above) and then edit the macro of the Properties command found therein from “^C^C_properties” to “^C^C_hatchedit”. Do not do this.

Why not to do it

If you edit the macro then try it out, it works fine. Why, then, does it matter which method you use? Because if you edit the macro, you are changing the action that occurs not just for the Hatch double-click, but for every place the Properties command is used. This means it will have undesirable side-effects in many places. For example, double-click on a circle after changing the macro and you will see something like this:
Command: _hatchedit
Selected object must be a hatch object or associative hatch block.
HATCHEDIT does not support old-format non-associative hatch blocks.
Select hatch object:

What to do if you’ve already done it

If you have already changed the Properties macro, go back into CUI and reverse the process, changing the macro back to “^C^C_properties” (without the quotes). When you are happy that you’ve fixed that up, use the click-and-drag method described above.

Screen captures created and modified using SnagIt 8 by TechSmith. Disclosure: Shaan Hurley gave me a free copy of this software (and Camtasia Studio 4, and a long-sleeved T-shirt which I promptly ruined by spilling red wine on it) at Autodesk University 2006.

How is your AutoCAD 2011 hatching?

Hatching is the poster child for AutoCAD 2011’s 2D drafting feature changes (although there are several other significant ones), and also for demonstrating the advantages of providing a contextual interface via the Ribbon. It looks great at first glance when working with simple demo drawings, but how are things going in the real world? I’d be interested in hearing about your experiences.

  • Is the hatch Ribbon tab snapping into place and going away quickly enough, both the first time it is used in a session and subsequently?
  • Is the Ribbon interface easy to use, efficient and complete?
  • Does the hatch preview always match what’s actually hatched when you accept the preview? If not, how often is it wrong?
  • Are you happy with the new default double-click hatch action? (If not, see the Hatch double-click section of my AutoCAD 2011 – Putting things back to “normal” post).
  • Does the hatch preview work quickly and accurately in simple areas? How about more complex areas? How about areas bounded by complex polylines with lots of vertices?
  • Is the performance up to scratch when creating and editing both associative and non-associative hatches? How about when grips are visible on complex bounding areas? How about when you make changes to hatches using the Properties palette?
  • Is boundary detection working reliably in finding and filling a closed hatch area? Even when using a solid or gradient hatch pattern?
  • How is your zoom and pan performance in drawings with a lot of hatching?
  • Have you noticed any problems with the new transparency and background features?
  • Have you experienced any hatch-induced crashes or lockups?
  • Are any of your hatch problems new to 2011, or do they also exist in earlier releases on the same PC when using the same drawings?

If your hatching performance is poor, have you tried changing the values of system variables to turn off features to see if the problems persist? Try HPQUICKPREVIEW = 0, HPDLGMODE = 1 and SELECTIONPREVIEW = 0. Also, if you are having display performance issues, try VTENABLE =0 and check using 3DCONFIG to see if your graphics card/driver combination is certified.