Bug Watch: You didn't really want to detach that xref, did you?9 Jun, 2006 By: Steve Johnson
What's in AutoCAD 2007 for 2D users? A new xref interface with bugs, thatâ€™s what.
Wild Thing (2007)
One of the few non-3D changes introduced by AutoCAD 2007 is the new Reference Manager palette. This tool is used as a one-stop shop for dealing with xrefs, images and the very handy new feature of attaching DWF files. Unfortunately, it doesn't always work correctly.
Let's say you attach an xref with a name of SITE PLAN [PROCESSING PLANT @ ALBANY].DWG. Now try to detach it. Right-click on it and pick Detach. It doesn't work, and AutoCAD displays this message:
No matching xref names found.
This problem occurs with any xrefs containing any of the following characters:
@ [ ] #
The same bug affects image files but not DWF files. What's going on? You can use those characters in AutoCAD when specifying wildcards, which is a very powerful feature. AutoCAD is erroneously passing the name of the xref or image through the wildcard parser when attempting to detach it, and it fails to find a match as a result. A lot of other wildcard characters could act in a similar way, but because Windows does not allow you to use those in filenames, they are not relevant. Four other AutoCAD wildcard characters that you can use in filenames don't get in the way:
. ~ - space
Autodesk kindly left the old Xref and Image commands in place, renamed as Classicxref and Classicimage. Do they work? Yes and no. Or rather, no and yes. Classicxref does not allow you to detach xrefs with these names, but Classicimage does allow you to detach images.
The problem with detaching xrefs goes deeper than just these commands. Even if a programmer tells AutoCAD to detach a specific xref object, which should bypass the xref name altogether, AutoCAD still insists on using the wildcard parser and refuses to detach the xref. So if you use third-party utilities to handle xrefs, they will break too. The example Visual LISP routine shows the problem in this month's Bug Watch code files. It works fine in 2006 and earlier with these xrefs but not in 2007.
Workaround: Reference Manager allows you to detach DWF files and ClassicImage allows you to detach images, so you are left with just xrefs to sort out. If you just have one of these, it's easily fixed because you can just rename the xref to remove the offending characters. You don't need to change the filename, just the internal xref block name. In Reference Manager, pick the relevant xref. Under Details, pick the Reference Name and edit it to remove the wildcards. Then you can right-click on the xref and pick Detach.
If you have a lot of xrefs to deal with, this process is tedious. I've written a little routine to strip out the wildcards from xrefs. Load it into AutoCAD (for example, drag and drop it onto the drawing area) and enter the command Xwcardstrip.
Click here to download the ZIP file that holds this month's Bug Watch code files.
Rename Shame 1 (2007)
If you rename an xref using the Rename command or via programming (for example, Xwcardstrip above), Reference Manager still displays the old name. The palette does include a button with Refresh, but this command does not work.
Workaround: If you reload the xref, the name will update. The button with Refresh on it also has a Reload All References option. This process is time-consuming with large xrefs.
Rename Shame 2 (14 to 2007)
This one is less of a bug and more of an inconsistency and missing feature. The Rename command and its command-line equivalent -Rename (note the leading hyphen) both lack an option for renaming images. In 2007, this shortcoming also applies to DWF files. It's almost as if the command was frozen in time when it was introduced as the Ddrename AutoLISP routine in Release 13. It really needs updating to reflect AutoCAD's current object types.
Workaround: You can rename individual images and DWF attachments by clicking on the names using the dialog and palette interfaces. However, this method does not provide the efficiency of the wildcard rename facility available in the Rename command.
About the Author: Steve Johnson
In her easy-to-follow, friendly style, long-time Cadalyst contributing editor and Autodesk Technical Evangelist Lynn Allen guides you through a new feature or time-saving trick in every episode of her popular AutoCAD video tips. Subscribe to the free Cadalyst Video Picks newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!
Poll not yet available.