Group Therapy15 Jul, 2004 By: Bill Fane
Create groups in AutoCAD so you can work with multiple objects as a single unit within your drawings.
It was a dark and stormy night. Captain LearnCurve finished marking the last of his students' final exams and submitted the marks to the registrar. Time to relax.
Suddenly an e-mail shouted out, "Hey, your column is late. Again." If nothing else, the Captain is consistent. Having pushed the Power of Positive Procrastination as far as he could, he reviewed last month's column to see if he could come up with a topic for this month.
As you may recall, last month we discussed the Region command, which basically creates infinitesimally thin 3D solids so that they're effectively 2D objects. Regions are very handy for quickly and easily creating a single odd-shaped object out of multiple boundary objects.
Powerful as they are, regions do have their weaknesses. For example, they can be formed only from boundary objects, so can't include things like text and dimensions. They can also be a bit of fun to edit.
I Like Groupies
Have you ever had to manipulate a set of several objects as though it were a single object? Of course you have. The standard technique is to create a block and then insert it once. This works, but has two small disadvantages.
First, blocks are intended primarily for multiple insertions. They don't make the most efficient use of disk space if you need only one insertion. Second, it can get a little messy when you want to revise one of the objects within, or add or remove objects from, the block definition. The RefEdit command is much better than the techniques we had to use in the "good old days," but it can still be a little awkward.
Have you ever carefully selected a group of objects to perform a specific editing function, then had to come back later to perform another edit on the same set? Of course you have. When a command asks you to select objects, you can always reply P to reselect the Previous selection set. This works only if you haven't built another selection set in between or exited from AutoCAD.
Fortunately, there's a solution.
You know, it's amazing how you always have a solution to any problem!
Rule #1 is to never create a problem unless you already have the solution.
The manual for Release 13 contained the best definition of a group: "A group is a named selection set of objects." That's right, campers, you can name a set of selected objects and reselect it by name later! When you save or end your drawing, the named selection sets are saved with it so you can reuse them in a later editing session. You can pick a single object and the entire set is selected as though it were a block, or you can edit individual objects without disturbing the rest of the group and without losing the group association.
For example, look at the simple drawing shown in Figure 1. You'd like to manipulate the individual views, and you may want to move details within the views.
Figure 1. A typical drawing.
Start by invoking the Group command. Interestingly, for such a useful command, it doesn't appear in the toolbars or menus, nor does it have a keyboard shortcut. It's in the Tablet menu and in the old Screen menu, but the only way for most users to start it is to type Group at the Command prompt.
You are now presented with the dialog box shown in figure 2.
Figure 2. Object Grouping dialog box.
Type a suitable name in the Group Name box-Top, for example. If you want, you can click on the Description box and enter an explanatory note.
Now pick the New button. The dialog box collapses and you're asked to : Select objects You can use any of AutoCAD's standard selection mechanisms (Pick, Window, Crossing, Add, Remove, and so on) to select all objects in the top view.
When you press Enter to complete the selection process, the dialog box reappears. Now the upper portion displays your group name, Top. Continue to name and define other new groups for Front and Side, and click OK to return to the Command prompt.
Now invoke an editing command, such as Move. AutoCAD again asks you to :
You can use all of the normal selection mechanisms, but now there's a new one available. Enter the letter G, and AutoCAD asks for a group name. Type Top and the group of objects you defined as composing Top is automatically selected.
Pick Me! Pick Me!
But wait, it gets better! You don't even need to type the group name. As part of your selection set for the Move command, if you pick a single object that belongs to the Top group, all objects within Top are selected, as though Top were a block.
Okay, so how do you edit an individual object within the group? Easy! Just start the Group command again. When the dialog box appears, the upper window lists the names of all defined groups. Click any desired group names to highlight them, then pick the Selectable button. Notice how the Selectable column in the Group Names window toggles from Yes to No and back beside the highlighted names as you click the Selectable button. Leave it at No.
Now click OK to return to the Command prompt. Start any editing command and select one of the objects in a nonselectable group. It will be the only object highlighted, as though it no longer belonged to its group. You can do any desired editing-Move, Rotate, Stretch, Mirror, Change Layers, whatever.
When selecting objects for other editing, however, you can't use the Group option and give it the name of a nonselectable group. As expected, a nonselectable group cannot be selected. Note that the term selectable refers to the entire group as a group. Nonselectable lets you select objects within a group.
Now start Group again. Highlight the group name and make it Selectable. Click OK to return to the Command prompt and try editing the same object. Hey, presto-the group is back together again and the modified object is still a member. Once again, you can select the whole group by name or select one of its members. That was much easier than trying to edit a block definition, wasn't it?
You just made one or more groups temporarily nonselectable and hence could edit individual members of a group. If the PICKSTYLE system variable is set to anything other than 1 or 3, all selectable groups temporarily become nonselectable. This system variable can be changed by entering its name at the Command prompt or by clicking Tools/Options/Selection tab and turning Object Grouping on or off.
Grip editing effectively makes a group temporarily nonselectable. If you're at the Command prompt and pick an object that happens to be part of a group, the entire group is selected and blue grips appear on every object in the group. Figure 3 shows an example of this.
Figure 3. Click an object to grip-edit the entire group.
Now when you click and drag a blue grip, that one object moves independently within the group. When you press Esc to clear the grips, the entire group becomes selectable again.
The Group dialog box offers several other useful functions. For example, have you lost track of a group's name? No problem. Pick Find Name. The dialog box collapses and you're invited to select an object. If you select one that belongs to a group, a box pops up listing the group name or names. An object can belong to more than one group.
If you pick a group name from the upper window of the Group dialog box, another inquiry function becomes available, as do several Change Group functions at the bottom of the dialog box. Figure 4 shows an example of this.
Figure 4. Select a group name to activate the Change Group buttons.
The function of most buttons is obvious from their labels, but one or two have a bit of a twist.
- You can Highlight a group, which temporarily collapses the dialog box and highlights all objects visible on screen that belong to the group.
- You can Remove objects from or Add them to the current group.
- You can Rename a group.
- You can change the Description.
- You can Explode a group. This is not like Selectable/Nonselectable. Once you explode a group, you lose the association among its objects and its name no longer exists.
- You can make a group Selectable or Nonselectable.
- You can Reorder a group, which is a little esoteric. When you create a group, the objects are added to it in the order in which you select them. By reordering a group, you can change the relative positions of objects within the group listing, which has an effect on which items end up on top when a drawing regens or redraws. This is effectively a mini Draworder command within the group.
What Do You Call . . .
When you created a new group, you were asked to give it a name, but one of the Pick buttons in the Create Group section is Unnamed. An unnamed group behaves exactly like a named group, with one obvious exception: You can't use its name to add it to an editing selection set because obviously it doesn't have one. (What do you call a dog with no legs? It doesn't matter; he can't come anyway).
An unnamed group can be added to a selection set only by picking one of its members and only when PICKSTYLE is set to 1 or 3. In the Group Identification portion of the dialog box, you can choose whether the Group Name window includes Unnamed. So how can it list the names of unnamed groups? Easy. Unnamed groups actually have names, but they start with an asterisk (*) to tell AutoCAD to ignore them. The Rename button lets you assign a name to an unnamed group, but you cannot unname a named one.
Now that you have seen the basic mechanism for creating, using, and editing groups, here are a few other significant points:
- A group can contain any type of AutoCAD object, including lines, circles, arcs, polylines, text, dimensions, block insertions, and other groups.
- An object can belong to more than one group. To select an object within an existing group so that it's part of a new group, the existing group must be nonselectable. If it's selectable, the entire group that it's within becomes part of the new group.
- If you're building a selection set for an editing command and pick an object that belongs to more than one group, all objects in all groups of which it's a member will be selected.
- If you copy, mirror, or array a group, all the new objects you create belong to a new unnamed group. The original group is unchanged.
- If you insert another drawing from disk into the current drawing, any groups it may have contained won't carry forward into the current drawing. The same holds true for xrefs.
- You aren't limited to using groups to add to a current selection set you're building for an editing command. You can also Remove objects in a group from a current selection set.
- If you're building a block definition and include an object that's a member of a selectable group, all objects in the group become part of the block definition and the group disappears.
- If you're building a block definition and include an object that's a member of a nonselectable group, the object transfers to the block definition. It's no longer a member of the group, but the rest of the group remains unscathed.
Given its power and ease of use, it's a little surprising that the Group command doesn't have more presence in the menu and toolbar structure.
Now that I know how to group, can I become state governor?
Sorry, that's "grope," not "group."
And Now for Something Completely Different
If you own a Hobie Cat sailboat, check the condition of the trapeze lines. You don't want to be running on a fast, screaming reach with your son-in-law hooked in to the "diaper" and hung out on the end of the trapeze line to keep the boat upright, and then have the line snap.
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!