AutoCAD

Learning Curve: Let's Get Out of Here!

15 Mar, 2005 By: Bill Fane Cadalyst

When and why -- and how -- to save an AutoCAD drawing in a different format


It was a dark and stormy night. Captain LearnCurve was hunkered down over the keyboard, desperately trying to come up with a clever lead-in to this month's column. He kept coming up dry, however, so he decided to simply launch straight into it.

Paul Simon once sang to us about "50 ways to leave your lover." Similarly, AutoCAD must have 50 ways to save a drawing. Oh, yes, I'm sure you know about Save and Save As, but do you know about Publish, Publish to Web, eTransmit, Export, Send, Plot, Cut, Copy and SaveImg along with all the variations within those commands? And how about the simple Print Screen button on your keyboard? Describing each of these could fill an article in its own right, so I'll just pick on one particular subset this month.

Have you ever created a drawing, then realized you could make good use of all or part of it as an illustration in a word processing document or as an illustration on a Web page? Of course you have.

When I began using AutoCAD, way back in the last millennium (circa 1986), the phrase "cut and paste" meant exactly that. We would plot the AutoCAD drawing to paper, then cut out the portion we wanted. A bit of glue would be used to stick it into the blank space that had been left in the printed text document. A quick trip through the photocopier, and we had a single document again.

The good news is that now there are a variety of ways of doing this electronically.

Before we get started this month, a bit of a review of graphic image file formats would be in order. In my April 2004 article, I detailed how to insert and manipulate image files (photographs and so forth) in AutoCAD. Speaking of cut and paste, the next couple of paragraphs were lifted straight from the aforementioned article because they are also relevant to the current discussion.

There Are Two Kinds of Graphics Files?
The most common type of graphics file is the raster image. This gets its name from the way an image is formed on a TV screen or computer monitor. Its presence is much more obvious if you look closely at an old black-and-white TV screen, where you will see that the picture is formed from 512 horizontal lines. Each line gets lighter and darker as it proceeds from left to right, and when all the lines are stacked up, the light and dark areas align to build the image. This horizontal line pattern is known as a raster.

Color TVs and computer monitors work the same way, but it is not quite as obvious because each horizontal line is composed of a series of colored dots. In the case of a standard TV, it is about 650 dots per line. A typical computer monitor will use 1024 dots in 768 lines, or whatever other resolution is specified.

Imagine a picture that has been through an office paper shredder. If the strips are fine enough, each strip will seem to contain just a series of colored dots. Now join each strip of paper end-to-end in sequence. That is exactly what happens when a raster image is saved to disk. The file consists simply of a listing of the color of each dot, dot after dot, and row after row. There are a number of file formats, including BMP, GIF, JPG and so on but they all accomplish the same thing. The image files have no particular intelligence. A line on screen is simply an appropriate alignment of dots.

On the other hand, all CAD systems, including AutoCAD, save their data to disk as a vector file. In such a file, a line is a line with a start, an end and a layer. Its properties can be altered, and the results will update on screen.

The problem is that a great many applications do not support vector files, and do not support AutoCAD's file format in particular, but we still want to display a drawing in those other applications. Okay, how do we get AutoCAD to produce a raster image?

Let Me Count The Ways
The easiest way is to just press the PrintScreen key on your keyboard. This simply captures a snapshot of your screen onto the clipboard. Now all you need to do is go to another application, such as a Word document, right-click and select Paste.

Like magic, a copy of your AutoCAD drawing will appear in your Word document. The bad news is, you will also get the AutoCAD menu, toolbars, command line and so on. What is worse, it literally captures your entire screen. If AutoCAD was not maximized on screen then you will also get the rest of your desktop, its icons and any other open applications (figure 1).

figure
Figure 1. Using your PrintScreen key will create an image capturing your entire computer screen.

There are two ways to capture just your drawing without all the background noise. The first is to press and hold the Alt key while you press PrintScreen. Actually, this is just a partial solution, because all it does is limit the capture to the currently active application window. It will still pick up the menu, toolbars, Command line and so on (figure 2).

figure
Figure 2. Pressing Alt+PrintScreen captures the current application window, without the rest of your desktop.

The other way is to paste the clipboard contents into a graphic image editor such as the Paint application that comes with Windows. You can now crop the image or cut a smaller region out of it to be pasted wherever desired.

Know Your Enemy
Before we move on to consider some of the other ways to get an image out of AutoCAD, we should study the limitations of a raster image.

The main problem is that it is indeed a raster image. As indicated earlier, a line is simply a fortuitous alignment of dots. If the resolution of the destination is different from the resolution of the source, problems can occur.

In AutoCAD, we are used to zooming in and out all we want. It is effectively an analogue image. For example, when you zoom in on the image in figures 1 and 2, you see a portion of the sample drawing WILHOME.DWG in greater detail (figure 3).

figure
Figure 3. AutoCAD lets you easily zoom in to view your drawings in detail.

A raster image, however, is digital. The only way to zoom in or out is to add or subtract pixels. That is why graphic image editors will often only let you zoom in 2x, 4x, 8x and so on. In fact, 8x is usually the upper limit of usability before the image becomes too coarse. Zooming in on my drawing as it appears in Paint (figure 4), it's not very impressive, is it? The bad new is that this is only a 6x zoom.

figure
Figure 4. A close-up (zoomed-in) portion of an AutoCAD drawing that was pasted into Paint.

The real problem with a raster image of an AutoCAD drawing, however, is that a fine horizontal or vertical line may only be one pixel wide. If you try to change the size of the image, you can easily end up losing lines out of your drawing. Similarly, if you attempt to scale a raster image by an odd amount such as 1.57, some lines will end up wider than others. When you zoom out of a raster image, you can lose drawing objects (figure 5).

figure
Figure 5. Zooming out of a bitmap image can cause loss of drawing objects.

These problems can come from two sources. Word, for example, will let you scale an inserted image by any percentage.

The other source can be printer resolution, because even laser printers are effectively raster devices.

The bottom line is that before you export a raster image from AutoCAD, you need to know exactly where it is going. In a perfect world the image should import into its destination at full size, or 100% scale factor. You need to know the space available for it in the receiving document, or the dots-per-inch rating of your printer.

Yes, I know: Autodesk says you should be using DWF format to put drawings on the Web. That's fine if you want others to be able to zoom, freeze and thaw layers, and to plot drawings, but if all you want is a simple image to show people, then a raster image can suffice.

How to Export a Raster Image, More or Less
Luckily, AutoCAD has several mechanisms for exporting a raster image.

Let's start with the Export command (File / Export). It has several file format options, one of which is the Windows generic BMP (BitMaP) format. The advantage to it is you can select the specific objects to be exported so you only get exactly what you want.

The bad news is that if you are in a paper space layout you cannot select model space objects unless you just press Enter instead of selecting objects. This latter move will select all paper and model space objects, and its gray sheet background displays, much as if you had pressed Alt+PrintScreen.

The only way to decrease the resolution is to shrink the drawing window before you start. You can't increase it.

But what if you want a higher-resolution image? Easy. We cheat. We don't export the image at all; instead, we simply plot to disk.

Start the Plot command. Expand the Plotter/Printer name list and select Independent JPEG Group. This creates a file in the JPG format so familiar on the Web. It is a raster image, but it is a compressed format, so usually the resulting file is a lot smaller than a BMP.

Your installation of AutoCAD may not show JPEG as a plotter type. If not, simply click on File / Plotter Manager / Add a Plotter Wizard. The wizard will guide you through the necessary steps.

The cheat here is that you can create a custom paper size, then plot to fit. Your JPG image can therefore be exactly the right size to suit the destination. The custom paper can be huge, and AutoCAD will calculate the required pixels as though you had a huge monitor. To create a custom paper size, simply click on the Properties button to the right of the printer list in the Plot dialog box. A new dialog box pops up that shows the plotter specifications. Click on Custom Paper Sizes, then Add to add a new paper size. You can create a paper size up to 320,000 x 320,000 pixels. That comes out to 89 feet square on a 300 dots-per-inch printer.

Careful What You Wish For
I almost forgot to mention that the various raster export mechanisms are indeed WYSIWYG (What You See Is What You Get). If your AutoCAD screen has a black background then your raster image will have a black background. This can make fine details very hard to see, especially on a printed page. You may want to change your model space background to white before capturing or exporting an image.

Upon My Word
The foregoing discussion is very helpful when you must use a raster format, but it is not always the best way to get an AutoCAD image into another application. The following discussion covers all the Microsoft Office applications including Word, Excel and PowerPoint. It probably applies to other applications as well.

These applications support the little-known vector file format WMF (Windows Meta File). To generate one from AutoCAD, you can enter the Wmfout command, or you can select File / Export and then select the WMF file type.

WMF is a full vector file format, so that you can resize the image all you want in the receiving application and you will get the same level of detail as you would when zooming in AutoCAD. Here I show the WILHOME.DWG sample file exported in WMF format then inserted into a Word document (figure 6). It shows more detail than a BMP would.

figure
Figure 6. An AutoCAD drawing exported to WMF format then inserted into Word.

Now we see another insertion of the exact same WMF file (figure 7). This time I right-clicked on the image in Word, and then clicked on Format Picture. I used the Scale options of the Size tab and the Crop options of the Picture tab to zoom a small section to a scale of 10x (1000%).

figure
Figure 7. Using Word's Format Picture options to zoom and crop a WMF image.

As you can see, it produces the same fine detail when zoomed as does the original AutoCAD drawing. Compare this to the zoomed bitmaps of figures 4 and 5.

The good news is that you can select the desired objects to be exported, or All. The bad news is that you can select model space objects or paper space objects but not both.

The really good news is that in current releases, a WMF has a transparent background. This means you do not need to set AutoCAD's background color to white before exporting; an imported WMF will take on the background color of wherever it is received.

In addition, WMF supports line weights if they were turned on in AutoCAD.

Color Me Gone
There is one other situation that might need a bit of remedial action, whether you select a raster or WMF format. Both formats support color, so when you print on a monochrome printer, it will usually default to attempting to portray colors as a grayscale. Yellows in particular will almost disappear, as shown here (figure 8).

figure
Figure 8. A color image printed on a monochrome printer.

If you are "plotting" a JPG, simply select the Monochrome plot style table.

You can't select colors if you are exporting a BMP or WMF. The brute force method would be to change all layer colors to black, but the easier way is to fix it up later in your Office document. Simply right-click on the imported graphic, click on Format Picture and select the Picture tab. Set the Color to Black and White, set the Brightness to 0% and set the Contrast to 100%. Now your image displays in black-and-white (figure 9).

figure
Figure 9. Word's Format Picture dialog box can be used to produce a black-and-white image.

All in all, exporting an image of an AutoCAD drawing to be used elsewhere need not be a daunting task, and the results can be very satisfactory if you know the underlying principles.

And Now For Something Completely Different?
When you rent a car, ask if you can select the color you want. The objective here is to choose the brightest, gaudiest color you can get. No, you might never actually buy a bright neon blue car, but it sure can make it easier to find an unfamiliar car in a strange parking lot.


AutoCAD Tips!

Lynn Allen

Autodesk Technical Evangelist Lynn Allen guides you through a different AutoCAD feature in every edition of her popular "Circles and Lines" tutorial series. For even more AutoCAD how-to, check out Lynn's quick tips in the Cadalyst Video Gallery. Subscribe to Cadalyst's free Tips & Tools Weekly e-newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!
Follow Lynn on Twitter Follow Lynn on Twitter


Poll
At your company, who has the most say in CAD-related software purchasing?
CAD manager
CAD users
IT personnel
vice-president/department manager
CEO/company owner
Submit Vote