I'll show you mine31 Dec, 2001 By: Bill Fane
Captain LearnCurve's depth gauge read 107', yet the water was so clear he could see birds in the sky. His dives at Punta Perdiz on the Bahia de Cochinos, better known to Americans as the Bay of Pigs in Cuba, would go into the log book as two of the all-time best out of 153. As he surfaced, the warm tropical breeze carried the cry of an anguished AutoCAD user: "My sales manager doesn't understand me!"
First Thing First
The first thing I teach in my Engineering Graphics I class is that a photograph or detailed pictorial drawing of a part is next to useless for engineering purposes. To accurately convey manufacturing information, we need to use dimensioned, annotated, multiview orthographic drawings. Those are fine until you need to explain your design to someone who can't read a blueprint. Sales, marketing, clients, and customers don't need to know detailed dimensions, but they do want to see what the design looks like. They need a picture.
Fortunately, AutoCAD comes equipped with a full set of visualization tools to display 3D models. They run the range from a simple hidden-line removal operation (figure 1) to photorealistic renderings complete with transparency and shadows (figure 2). This month's column introduces basic principles to start you on the road from figure 1 to figure 2.
|Figure 1. AutoCAD can perform a simple hidden-line removal of 3D objects.||Figure 2. AutoCAD can also generate photorealistic renderings of the same objects.|
I'll use mechanical parts for simplicity, but the same principles apply to any 3D model, up to and including architectural models of buildings or complete towns.
Hide and Seek
Figure 3 shows a simple 3D model I generated using standard AutoCAD solid modeling techniques. Confusing, isn't it? Even though it was built as a solid model, it normally displays as a wire frame that just shows the edges.
The first visualization command to appear in AutoCAD was Hide. To ensure that your system's behavior matches our example, you first need to set the following:
From the menu bar pick View | Shade | 2D Wireframe, or pick the 2D Wireframe button on the Shade toolbar.
At the Command prompt enter the system variable D I S P S I L H and set its value to 0 (zero).
Now, pick View | Hide to launch the Hide command. Figure 4 starts to get a little easier to understand.
Keep in mind the following points about the Hide command.
- Solids are not the only thing that react to the Hide command. Standard lines, arcs, and text that uses AutoCAD SHX fonts (as opposed to Windows Truetype fonts), if they have thickness, hide objects behind them as though they were thin sheet-metal walls.
- 3D faces and polygon meshes hide objects that are behind them.
- Circles with zero thickness behave as though they were thin-sheet disks. If they have thickness, they hide their own internal details and objects behind them as if they were solid cylinders.
- Polylines with width and zero thickness act like thin ribbons. If they have thickness, they hide themselves and other objects as though they were a solid bar.
- When you finish admiring the hidden view, you must Regen the drawing (select View | Regen) to get the wire frame back before you can zoom or pan in real time. Starting 3D Orbit automatically forces a Regen that unhides the model.
- You can edit the drawing while it is hidden.
Note the triangular patches that appear all over the curved face in figure 4. You can set the DISPSILH variable to 0 (zero) to turn them on (figure 4), or to 1 to turn them off (figure 5). This is backward from what you might expect, but I won't bore you with the long explanation.
|Figure 3. A wire frame representation of a model of a 3D part.||Figure 4. The part is easier to understand with hidden lines removed.||Figure 5. You can turn off the triangles on the curved face.|
Later releases of AutoCAD feature more advanced hiding and shading functionality, so Hide is not used as much today. The only reason to bring it up now is that if you plot a drawing with Hide Edges turned on, the plot produces hidden objects exactly like the Hide command. In particular, note how DISPSILH affects the presence or absence of the triangles on curved faces.
Do you see what I see?
Current AutoCAD releases have a much more powerful command called Shademode. The Shade toolbar and the View | Shade menu picks each appear to have seven commands below them, but these are actually just seven different Shademode settings. That they are modes rather than specific commands is significant.
If you select Hidden mode, the drawing looks much like figure 5 again, except Hidden is now a "sticky" setting. As you edit, zoom, pan, and 3D orbit the model, the "hidden" view continuously updates in real time.
You should also note a couple of other differences from the Hide command, and hence from hidden plots:
- DISPSILH has no effect. Curved surfaces always hide without showing the triangles.
- Circles with thickness hide other objects as though they are lengths of tubing rather than solid cylinders.
- The thickness of thick (as opposed to wide) polylines is ignored. They hide objects as though they had zero thickness.
This is a continuous mode, so it overrides the Hide command. Before you can use the Hide command again you must set Shademode to 2D Wireframe. The easy way to do this is by menu or toolbar pick.
It's cool in the shade
Current releases of AutoCAD go far beyond the simple hidden-line operations we have discussed so far.
Let's start with the different shading operations. From the menu bar pick View | Shade | Gouraud Shaded, or pick the Gouraud Shaded button on the Shade toolbar. This produces figure 6, which is beginning to look a little more realistic. The part is illuminated by a single light source located above and to the left. The color of each face is determined only by its distance from the light (farther away is darker), and there are no shadows.
|Figure 6. The part is easier to understand when Gouraud Shaded is applied.||Figure 7. The Flat Shaded option is faster, but the curved surface now has flat facets on it.|
Once again, this is a mode of the Shademode command, so it works in real time. You can edit, zoom, pan, snap to, and 3D Orbit the shaded model.
Besides Gouraud, three other shade modes are available. Figure 7 shows Flat Shaded mode. Notice how a series of flats replaces the nice, smooth curved face of figure 6. This mode is less realistic than Gouraud, but generates more quickly on a complex part with lots of curves.
|Figure 8. Gouraud Shaded with edges on. The wire frame shows through the "glass" part.||Figure 9. Flat Shaded with edges on.|
Figures 8 and 9 show the final two modes. These are Gouraud and Flat with edges on. Notice how the part seems to be made of colored glass so you can see the wire frame showing through.
The edges-on modes can be useful when you edit the shaded model. AutoCAD always snaps to objects in the model, even when they are hidden or shaded, but edges on makes it easier to snap to the correct place.
Now that you have a nice shaded image of the part, how do you show it to someone else who doesn't have AutoCAD? Simple. Press the <Alt> <PrintScreen> key combination. This takes a snapshot of your entire AutoCAD window and places it on the Windows Clipboard. You can now paste it into almost any other Windows application, such as a Word document or PowerPoint presentation.
Paste your image into Paint first to crop it down to cut out the menu bars, Command line area, and so on. This is how I create all the screen shots for my articles.
Be sure to come back next time when we play with the Render command. You'll learn how simple it can be to produce very realistic images of your AutoCAD models.
And now for something completely different
If you ever go to Cuba, do not take a satellite GPS receiver with you. They x-ray your baggage when you arrive. Four people needed six pieces of paper and 45 minutes to confiscate it on the way in, and three more people needed four more pieces of paper and another 45 minutes to give it back a week later on the way out. Other than that, it was a great vacation.