Monthly Archives: May 2011

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.

How to make Ctrl+C perform a Cancel

In a recent comment, I was asked how to make Ctrl+C perform a Cancel. Before I get onto that, here’s a bit of history.

Back in the Dark Ages of DOS, the way to cancel a command was by holding down Ctrl and pressing C. The last release to work like this by default was Release 13 for DOS, released in 1994. I remember the bother it caused my users who were faced with the Windows version in which Esc was used to cancel things and Ctrl+C copied objects to the clipboard. It took me at least a year before I had totally removed Ctrl+C = Cancel from my muscle memory.

Until AutoCAD 2005, Autodesk provided an easy option to keep things the way they were by turning off the toggle Options > User Preferences > Windows standard accelerator keys. In recent AutoCAD releases, you have still been able to do it, but it’s a little more involved and uses the CUI command. Here’s how:

  • Enter the CUI command.
  • In the top left pane, burrow down to Keyboard Shortcuts > Shortcut Keys.
  • In the bottom left pane, scroll down to find the Cancel item. Click and drag it onto Shortcut Keys in the top left pane. Because of a long-standing auto-scroll annoyance in the CUI interface, you will find this easier if you drag off to the right, then up, then left onto Shortcut Keys.

That adds Ctrl+C = Cancel to the set of shortcut keys AutoCAD understands, but it won’t work yet because it will clash with the Ctrl+C = CopyClip shortcut key that’s already in there. We need to get rid of that before we’re finished in CUI, or more usefully, assign it to a different key:

  • Find Copy Clip in the Shortcut Keys list in the top left pane and click on it.
  • In the bottom right pane, find Access > Key(s). Where it says CTRL+C, change that to something else of your liking (e.g. CTRL+ALT+C). If you pick the […] button, you will be able to record the keystroke sequence directly instead of typing it in and worrying about syntax.
  • Pick OK and you’re done.

This post may be directly useful to only a handful of people who are still holding out after all these years, but it also serves as an introduction to a more generally useful skill; setting up keyboard shortcuts in CUI.

Installation tip – save time and space

If you download AutoCAD or other Autodesk products from either the trial or Subscription sites, the executable you get (e.g. AutoCAD_2012_English_Win_32bit.exe) is actually a self-extracting archive rather than a real installer. When you run it, you are prompted for a destination folder, with a default location such as this:

C:\Autodesk\AutoCAD_2012_English_Win_32bit

The actual installer (setup.exe) and all of the files it needs are then unzipped and placed in a folder structure in that location. When the extraction is finished, the self-extracting executable automatically runs setup.exe and the installation proper can begin. Once the installation is complete, the extracted files are left in place.

You can take advantage of this simple knowledge in various ways:

  • Sometimes, you may you need to run the installer more than once on the same PC. For example, you might need to uninstall/reinstall AutoCAD, or you might be a CAD Manager who installs AutoCAD for on your own PC and later creates a deployment for the other users. Or you might start installing AutoCAD, cancel it for whatever reason, then come back to it later. If so, don’t just run the downloaded executable again. Instead, locate the actual setup.exe installer that has been left behind and run that instead. That cuts out the extraction step and saves time.
  • If you’re going to do standalone installs on several PCs rather than making a deployment, don’t go through the extraction process again and again. Instead, do it once and then copy the extracted folder to a location that can be used from other PCs. This might be a USB drive or DVD, which you can store safely for later reinstalls. If you are going to install to the other PCs from a network drive, during the first install you can directly specify that as the destination folder and cut out the manual file copying step.
  • If you think it’s unlikely you’re going to need the extracted files again, you can delete or move them and recover the space. If you download a product and install it, you end up with three copies of the product files using up your space; the self-extractor, the extracted files and the installed product itself. It probably doesn’t all need to be on your C: drive. Although bulk hard disk space is plentiful and cheap, it’s becoming more common to use a small high-speed drive or SSD as the OS/program drive drive, and you might have a significant portion of it given over to a bunch of files you don’t need. Because Autodesk products are increasingly (and sometimes completely pointlessly) bloated, you might be surprised at how much space you can recover.
    However, as Chris Cowgill has pointed out, you may need to have the “media” available when you install Updates, etc. Keeping a copy of the extracted files on a DVD or USB key should do the trick if you’re hard up for hard disk space.

Note that this applies to the Windows downloads only; I know nothing about the mechanics of Autodesk’s Mac installation downloads.