cadalyst
AutoCAD

may I take your order?

30 Jun, 2003 By: Bill Fane


It was a clear, crisp Friday afternoon. Captain LearnCurve and his gorgeous wife played hooky, sneaking up to Whistler for a pleasant day of skiing. Before the drive back to town, they stopped in the village for a coffee, where their children and grandchildren greeted them with "Surprise! Happy birthday! We've rented a couple of condo units, and everyone is staying over for a weekend of skiing!" And so Grandpa LearnCurve spent his 60th birthday taking the double black diamond runs at Whistler.

When he returned home on Monday, he opened an e-mail from reader Bill Stewart, who asked: "Can I fill an area on a map and have that fill color be translucent so that I can see the mapping through the color?"

There is a simple solution to this problem that can be done as far back as AutoCAD Release 14. It's based on the Draworder command. In fact, the solution has applications beyond the problem at hand. Read on to find out how you can use Draworder to its full advantage.

WHO'S ON TOP?
Let's begin with a bit of background information. Like most CAD software, AutoCAD is a chronological program. This means that objects

figure
Figure 1. I applied the hatching after I drew the lines.

figure
Figure 2. Next I added solid-filled hatching over other objects.

are added to the database in the order in which you create them, so even when you're working in 2D, the younger objects display on screen as though they're on top of older objects. This can have a significant effect on how a drawing appears on screen and on how it plots.

In figure 1, I drew a simple black rectangle and the two lines, and then added the red hatch pattern. To emphasize the problem, I set the lineweights a bit wider. Notice how the ends of the hatch lines sit on top of the rectangle and cut across the two black lines. This is not only distracting on screen, but is often how it plots on a color printer.

BUT WAIT-IT GETS WORSE
Now let's edit the hatch pattern and turn it into a solid-filled version. Oops! Half the frame lineweight disappears, as does one entire line and a portion of the other, as shown in figure 2. The younger solid-filled hatch covers them. The real problem is that the drawing plots this way-the covered objects disappear behind the solid-filled hatching. Luckily, there is a clever fix.

GET THEE BEHIND ME
First, let's go back to the standard hatch pattern in figure 1. Select Tools | Display Order | Send To Back to start the Draworder

figure
Figure 3. Using the Draworder button on the Modify II toolbar, I moved the hatching in figure 1 behind the rest of the image.

figure
Figure 4. I used the same technique on figure 2 to move the solid-filled hatching to the back.

command. You can also start it by clicking the Draworder button at the left end of the Modify II toolbar.

Select the hatching, then press <Enter>. Magic! The hatching is now behind everything else and plots accordingly. Figure 3 shows the results.

You can use the same process on the solid-filled hatching in figure 2 to produce figure 4.

AUTOCAD, WE HAVE A PROBLEM
Uh-oh! If we try to plot figure 4 on a monochrome printer, we end up with a black blob. Once again the line and line segment vanish under the solid-filled hatch, even though the hatch is on the bottom. The problem is that black on black is still black. I could have inserted a screen shot here, but I think you get the picture.

Once again, there is a simple solution. (Rule number 1 is to never come up with a problem unless you already have the solution.) First, choose a color for your solid-filled hatching and use it only for this purpose. Although my example appears red, AutoCAD color #1, it's actually color #10. You can change the hatch object properties to apply the desired color, but a better approach is to put all solid hatching, filled with the color of your choice, on a unique layer.

Now start the Plot command. On the Plot Device tab of the Plot dialog box, select a Plot Style Table (pen assignments) from the scroll list. Although I draw in color, I plot to a laser printer, so I use the monochrome color table.

Now click on Edit. When the dialog box in figure 5 comes up, click on the color you chose for the filled area (red #10 in my example).

figure
Figure 5. After selecting a color and assigning it specifically to solid hatching, I saved it in the Plot dialog box.

In the Properties window, set Screening to 20%. Click on Save and then Close. You may want to select Save As to create a new style rather than write over the standard one. This operation needs to be done only once, because all future plots that use this style table will plot color red #10 as a 20% screen.

TWO WRONGS MIGHT MAKE A RIGHT

figure
Figure 6. With a little bit of tinkering, I made hatching appear to be a translucent layer on top of the objects “beneath.”
Select the plotter, paper size, scale, plot area, and so on, and then complete the plot. Look at figure 6-all red #10 regions plotted as a 20% translucent screening, with everything behind it plotted solidly on top. It looks as though you can see it through the screening, even though the objects are actually in front of it. I won't tell if you won't.

ONE-UPMANSHIP
Note that the Draworder command does more than just move an object or objects to the back of the stack. You can also bring one or more to the front, or place a set of objects above or below another. Note that if you move more than one object, their relative orders within the selection set are maintained.

Another point to keep in mind is that the order is set when you run the command. If you move something to the front and then draw over it, the new item becomes the front item. This also occurs when you alter the boundary of an associative hatch region. The hatch is recreated and moves back to the top.

You can still use this shading method if you use Named Plot Styles instead of the default color style (pen assignment) method. You can create a specific "20% shade" style and apply it to specific objects, independently of their color. You must create the original

figure
Figure 7. To stop the raster image from blocking the screened hatching, I used a Dots hatch pattern on the area of interest and then placed it in front of the raster image.
drawing from a template that supports named styles-you can't convert later.

When I sent all this off to Bill Stewart, he wrote back: "Thanks, but it doesn't work for what I'm doing. I want to apply a translucent shading over part of a scanned raster image imported into AutoCAD. The problem is that the raster image appears to be a solid object, so it blocks the screened hatching."

No problem. Simply hatch the desired area with a Dots hatch pattern and put it in front of the raster image. A bit of playing with the hatch scale and lineweight produces the desired effect (figure 7).

AND NOW FOR SOMETHING COMPLETELY DIFFERENT
If you are a scuba diver and do underwater photography, you need access to Adobe Photoshop. Water filters out reds and yellows, so your pictures come out with a decidedly blue-green tint (figure 8). Simply open the picture in Adobe Photoshop, then select Image | Adjustments | Auto Levels or press -1L. Presto! The reds and yellows are restored, as shown in figure 9.

figure
Figure 8. Water tends to filter out reds and yellows, giving underwater photography a wan look.
 
figure
Figure 9. After a little help from Adobe Photoshop, doesn’t the image in figure 8 look much better?


More News and Resources from Cadalyst Partners

For Mold Designers! Cadalyst has an area of our site focused on technologies and resources specific to the mold design professional. Sponsored by Siemens NX.  Visit the Equipped Mold Designer here!


For Architects! Cadalyst has an area of our site focused on technologies and resources specific to the building design professional. Sponsored by HP.  Visit the Equipped Architect here!