Did AutoCAD Modify Your Drawings without Permission? (Bug Watch AutoCAD Tutorial)

29 Feb, 2008 By: Steve Johnson

Yet another scale list problem, and how to make sure your toolbar bitmaps always look their best.

Mysterious Modifications (2008 to 2008 SP1)
In some cases, opening a drawing will modify child xref drawings that are attached to it. This happens without seeking permission, and it modifies the xref drawing time stamps. It goes without saying that this is extremely bad behavior.

Workaround: None known.

In a Bind About Scales (2008 to 2008 SP1)
In November 2007 I described one of the many problems with AutoCAD 2008's scale lists and followed this up in January with most of the other problems. However, here's a bug that will prevent you from using some of the possible workarounds.

If you have a drawing with xrefs and you reset the scale list or delete any of the xref scales (even those not in use), you will run into problems if you try to bind any of your xrefs during the same AutoCAD session. In some cases, AutoCAD refuses to perform the bind at all. In other cases, binding causes your xrefs to vanish altogether! This applies whether the scales are removed using AutoCAD commands or by LISP routines such as ScaleListDel.lsp, which I provided in November.

Workaround: Strange as it may seem, the vanishing xref case is actually preferable. If this happens, having made sure you have a safe copy of the original drawing, save and reopen the drawing. The bound xrefs should (fingers crossed!) reappear.

If you have set up AutoCAD to perform a scale list reset on drawing startup, you may have to change that and make it a manually triggered process instead.

Broken Button Bitmap Backgrounds (2004 to 2008 SP1)
If you have customized AutoCAD's toolbars, you have probably created your own button images at some point. If you have had trouble getting the button image backgrounds looking right, you are not alone. AutoCAD hasn't made life easy for you, particularly if you have to support older releases or give your toolbars to people using releases or operating systems that differ from your own.

First, a little background information. AutoCAD's standard toolbar images come from its own built-in library, but if you create your own they are saved as bitmap (*.bmp) files. You can create these files yourself using Paint or any other bitmap editor of your choice, or you can use the bitmap editor that is built into AutoCAD. If you do the latter, a trap has been laid for you. Let's have a look at the typical process of creating a toolbar button with a custom image. In this example, I've used AutoCAD 2008 and skipped the part where the actual macro (command sequence) is entered.

Creating a toolbar button complete with image.

Here's a closeup of the end result.

A closeup of the new button image in place.

So far, so good. Or is it? Let's have a look at what happens if I change my Windows settings a bit.

Our button image has a square around it, but the standard AutoCAD ones don't.

If you are sharing your toolbars with other people using earlier releases of AutoCAD or other operating systems, you will see the same kind of thing. It's not fatal, but it doesn't look very professional. Even on the same system running the same AutoCAD release and without changing any Windows settings, there are similar results when using the button image in the AutoCAD 2008 Dashboard, although the shade of gray is very subtly different, so it's not at all obvious.

The gray square around the image indicates that the bitmap has been saved with a shade of gray that AutoCAD is not recognizing as a transparent background. That shade of gray has an RGB value of 236,233,216, which is normally the same as that used in AutoCAD's toolbars in Windows XP.

Workaround: The shade of gray that AutoCAD recognizes as a transparent background is actually 192,192,192. This applies from Release 13 to AutoCAD 2008. If you open the *.bmp files in a bitmap editor such as Paint, you can flood fill them with the right color, as shown here.

Fixing up the background color to make it transparent.

An alternative strategy is to avoid the rather feeble AutoCAD bitmap editor altogether. Instead, create your own image files using a bitmap editor of your choice, making sure you use 192,192,192 as your background color. If you're creating more than one or two buttons, that's likely to be a more productive strategy, anyway.

If you're supporting older AutoCAD releases, make sure you know what size the bitmaps need to be because AutoCAD has a long history of giving you the wrong information. See Bug Watch, March 2007 for the full details.

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!