AutoCAD Services & Support

Applying Customization: Shademodes

Now that summer is almost over, it’s time to get back to work with AutoCAD® software. This month we first look at Shademode options in AutoCAD 2000, 2002 and 2004. For 3D or solids work, the Shademode options can be your best friend. Second, we look at a Visual LISP® routine that makes activating the various Shademode options easier.

Shading a Model

The Shademode command in AutoCAD software gives you the ability to shade 3D models, producing a quick and fairly realistic “picture” of how the model looks in 3D space. There are seven options for the Shademode command:

Command: shademode
Current mode: 2D wireframe
Enter option [2D wireframe/3D wireframe/Hidden/Flat/Gouraud/fLat+edges/gOuraud+edges] <2D wireframe>:

The results of applying these modes to a 3D model are shown in Figure 1.

Figure 1: Shading options available with Shademode command.

Starting at the top-left viewport and working clockwise, these modes are as follows:

  • 2D Wireframe/3D Wireframe: Displays objects using lines and curves to represent boundaries. This is the default display mode for both 2D and 3D objects. (3D Wireframe mode differs only in that it displays a shaded UCS icon.)
  • Hidden: Similar to 3D Wireframe but hides line representing back faces.
  • Flat Shaded: Shades the objects between polygon faces.
  • Gouraud Shaded: Shades objects and smoothes the edges between faces. Yields a smoother and more realistic appearance.
  • Flat Shaded, Edges On: Combines flat shaded and wireframe.
  • Gouraud Shaded, Edges On: Combines Gouraud shaded and wireframe.

The difference between some of the Shademode options is subtle. Figure 2 shows a more detailed representation of Gouraud shading (left) and Gouraud shading with edges on (right).

Figure 2: Gouraud shading (left) Gouraud with edges (right).

Figure 3 shows the difference between the 2D Wireframe and Hide options. The Hide option provides no shading per se, but it removes the ambiguity as to whether the sphere is in front of or behind the other object.

Figure 3: Removing hidden lines with the Hide option.

Shortcuts to the Shademode Options

Once you realize the utility of the Shademode options in 3D work, you’ll want to use them frequently. Once again, Visual LISP can be of use. Following is a LISP routine that enables you to invoke the Shademode command by typing just the letters SM. You can then type the shortcut letter(s) for the Shademode option you want.

(defun c:sm ()
  (command "._shademode")
  (princ)
)

This routine provides quick access to all the Shademode options since it simply calls the Shademode command. If you use one of the Shademode options more frequently than the others—the Gouraud mode, for example—here is an expansion of the preceding routine that gets you in Gouraud mode quickly by simply typing gou and pressing Enter.

(defun C:gou ()
  (command "shademode" "G")
  (princ)
)

Getting out of a Shademode option and back to 2D wireframe is a frequent operation. Here is the shortcut:

(defun C:2DW ()
  (command "shademode" "2D")
  (princ)
)

Just type 2DW and press Enter.

Note: These LISP routines work only in AutoCAD 2000, 2002 or 2004. The Shademode command is not available in earlier releases of AutoCAD software.

To have these routines available whenever you start AutoCAD, cut and paste them into your ACAD.lsp or ACADDOC.lsp file. (For more information about these two files, see the AutoCAD help file.)

Working in 3D is much more difficult without the Shademode options. Make your 3D life easier by using the LISP routines presented this month. Next time: More about solid modeling