AutoCAD

an edit off the old block

1 Mar, 2003 By: Bill Fane


Captain LearnCurve and his gorgeous wife had just returned from their Grand Tour. Leaving Vancouver, B.C., on September 26, they reached Boston on October 8, Key West on October 30, and returned home by November 20. They drove slightly more than 12,000 miles in 56 days. Their Honda Civic averaged nearly 37 miles per U.S. gallon.

As the Captain caught up on his accumulated snail mail, the AutoCAD Clinic column by Mike Tuersley and Fred Washington in the December issue of Cadalyst (p. 47) grabbed his eye. John Petrovich had asked about editing a block definition without losing the attribute values. Mike and Fred answered John's question in one paragraph that said to use the Refedit command.

This answer is perfectly correct, but does not begin to hint at some of the other power available within this command. It's now a month later, the night before his deadline, and so the desperate Captain decides to pick Refedit as this month's topic.

BEGIN WITH A BLOCK
Let's work through the general case of a simple block edit, and then move on to the power stuff.

Start by creating a drawing of a simple link, as shown in figure 1.

figure
Figure 1. Draw a simple link.

You want this link to be part of an assembly, so it would be convenient if it were a single block rather than separate objects. Pick Draw | Block | Make and turn the six separate objects into a single block called LINK.

Now create the pivot, as shown in green in figure 2.

figure
Figure 2. Add the green pivot as a block definition.

Once again, make it a block and call it PIVOT. Next, insert a second copy of the pivot off beyond the right end of the link. As you insert it, rotate it to an angle, as shown in figure 3.

figure
Figure 3. Add another rotated insertion of the green pivot.

The problem now is that the pivots are positioned correctly, but the link is too short.

No problem! Start the Refedit command by picking Modify | In-place Xref and Block Edit | Edit Reference.

figure
Figure 4. Reference Edit dialog box.
When AutoCAD invites you to Select Reference, pick any object within the Link block. This summons the Reference Edit dialog box (figure 4). The Reference Name window shows the name of the selected block, and a thumbnail image appears in the Preview window.

Click OK. The dialog box collapses, and AutoCAD prompts you to Select nested objects. You must pick at least one object. For our purposes, pick the two horizontal lines and the right-hand arc and circle, then press .

At this point, two things happen. The Refedit dialog box appears, and all nonselected objects, both within and outside the block, fade. If they don't fade enough, type in XFADECTL at the Command prompt and set this system variable higher, say to 75 instead of the default 50. Figure 5 shows the screen at this point.

figure
Figure 5. Link definition, ready to edit.

The group of selected objects, whose appearance remains normal, is referred to as the "working set".

Now use the Stretch command with object snaps to stretch the objects in the working set until the center of the link circle coincides with the center of the right-hand pivot. Note that object snaps continue to work with all other objects within the drawing.

While you are at it, add a rectangle so your drawing looks like figure 6.

figure
Figure 6. Edited link.

Note that the new rectangle is automatically added to the working set. Try erasing or moving the left-hand circle of the link. You can't, because it is not part of the working set, even though it is part of the block definition.

When you are done, select the right-hand button in the Refedit toolbar or Modify | In-place Xref and Block Edit | Save Reference Edit to run the Refclose command to save your changes back to the drawing. Click OK in the alert box. Presto! The Refedit toolbar is dismissed, and your drawing updates to show the changes to the block definition (figure 7).

figure
Figure 7. Refclose saves changes back to the drawing.

You've edited the link within the context of where it fits.

BUTTON LOWDOWN
Let's briefly look at the other Refedit toolbar buttons, each of which has an equivalent menu pick. Then we'll go on to cover more features of the magic Refedit command.

You already saw how the right-hand button saves your changes back to the drawing.

The second button from the right discards your changes and cancels everything, as though you'd never started the Refedit command.

We saw earlier how you can't edit objects outside the working set. The two left buttons let you add and remove objects to and from the working set. Sort of. You can add objects, including other block insertions, from outside the parent block definition. However, you can't add objects from within the block definition that were not part of your original working set. That includes anything that was previously removed within the edit.

If an object from the original definition was in the working set and was edited, then removed from the working set, AutoCAD retains its edits when you save your changes.

Another point to note is that adding an outside object and then removing it also removes it from the edited block definition. It isn't added to the block unless it's part of the working set when you save changes.

REFEDIT WRINKLES
Now that you've seen the basics, let's move on the fun stuff. Go back to your drawing, which should now look like figure 7. Start Refedit again, but this time select the right-hand pivot. Select a suitable working set within it, then change the circle diameter to be a little smaller than the right-hand circle of the link.

Save your changes, and like magic, both pivot insertions update. Did you really expect otherwise? They are two insertions of the same definition. The point here is that it doesn't matter which insertion you Refedit, or whether it's rotated. In fact, the insertion you edit can even be scaled to a factor other than unity, provided the scale factors are the same in all axes.

THE NESTING INSTINCT
In AutoCAD, block definitions can be "nested," which means that a block definition can contain other block definitions as components within it. The nested block in turn can contain other block definitions within it, and so on down to any level of nesting.

When you launch Refedit, AutoCAD asks you to select a block reference for editing by picking an object within it. If you pick an object that is part of the top-level or parent block, that is the only block you can edit, and nested blocks are ignored.

However, if you pick an object that is part of a nested block, the Reference Name window of the Reference Edit dialog box displays a tree structure of all nested blocks above the selected one, all the way back to the parent. If you click on an item within the tree, the preview window shows the selected nested block.

You can also click on Next to step your way through the tree structure.

When you click OK, you can edit whichever sub-block is highlighted within the tree at that moment.

HOW ABOUT THOSE ATTRIBUTES?
As noted earlier, December's AutoCAD Clinic explained how to use Refedit to edit attributes. I'll quickly review the process here.

Look again at the Reference Edit dialog box in figure 4. Note the little check box in the lower left corner labeled Display Attribute Definitions for Editing. When it's left blank (the default), attribute definitions and their current values are ignored and will be preserved during the editing process.

On the other hand, when you check that box, AutoCAD brings in attribute definitions as part of the block definition. You can edit the definitions, and hence their locations, appearance, tags, and so on. Unfortunately, this does not retroactively update existing block insertions, not even the one you are editing. It affects only new ones created after you edit the definition.

GET THE X OUT OF HERE!
But wait! There's more!

Everything described so far works exactly the same way with xref (external reference) drawings. You can edit an externally-referenced drawing, or even a nested block definition within nested xrefs, simply by starting Refedit and then selecting a suitable object to pick the desired reference. You can make changes within the context of the block's parent drawing and within the context of the master drawing, so you can easily see whether things fit properly. When you save your edits, AutoCAD writes the changes back to the xref file, and everything updates. Obviously, this can't be done if the xref lives on a network and someone else has it opened for editing.

As you've seen, AutoCAD's in-place block and xref editing capabilities makes editing much faster, easier, and more accurate.

AND NOW FOR SOMETHING COMPLETELY DIFFERENT
When taking a long, unstructured car journey with a spouse or significant other, there are three things you absolutely must have if the relationship is to survive:

  • A sense of adventure.
  • A sense of humor.
  • A laptop computer with good mapping software, connected to a GPS receiver.


AutoCAD Tips!

Lynn Allen

Autodesk Technical Evangelist Lynn Allen guides you through a different AutoCAD feature in every edition of her popular "Circles and Lines" tutorial series. For even more AutoCAD how-to, check out Lynn's quick tips in the Cadalyst Video Gallery. Subscribe to Cadalyst's free Tips & Tools Weekly e-newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!
Follow Lynn on Twitter Follow Lynn on Twitter


Poll
At your company, who has the most say in CAD-related software purchasing?
CAD manager
CAD users
IT personnel
vice-president/department manager
CEO/company owner
Submit Vote