Clipping Right Along with Xrefs (Learning Curve AutoCAD Tutorial)1 Nov, 2008 By: Bill Fane
We continue the discussion started last month about the power of the mighty xref.
It was a hot summer afternoon and once again Captain LearnCurve was on special assignment, this time in Colonial Williamsburg, Virginia. The temperature was well above 100 degrees Fahrenheit, but he didn't mind because the air conditioning in the brand-new Bentley Continental GT Speed that he was driving was working perfectly.
Don't tell me the Captain bought a new Bentley Continental!
No, I said he was driving one. He and his gorgeous wife were attending the Rolls-Royce Owners' Club Annual Meet, and the factory reps had brought several demo Bentleys along.
Anyway, an opening appeared in the traffic. Although the speed limit was only 45 mph, he gave the accelerator a quick jab and within moments the twin-turbo 6.0-liter W12 had pushed the speed past 75 mph. This was still far short of the car's top speed of over 200 mph...
…that's it! Something relevant to this month's column!
What, pray tell, does 200 have to do with anything in AutoCAD?
Nothing. The significant point here is that this is Learning Curve number 200 in an open-ended series that began in early 1987. Be the first on your block to own the full set.
Last month's column introduced the Xref command. It is more properly called the ExternalReferences command, but Xref is an alias for it and is much easier to type. Using it, we saw how we can build a large drawing by linking other drawings to it. Three examples we considered were the use of a standard title block and border drawing, a machine assembly drawing that consisted of links to the individual parts, and an architectural drawing wherein the site plan, foundations, walls, plumbing, and wiring were all in separate files but can be displayed in one master drawing in order to check for interferences.
As we saw, the Xref command works almost exactly like inserting a block, except the block definition does not live in the current drawing. Instead, we point to an external drawing file on disk, which gets reloaded from disk whenever you open the master drawing. Everything always stays up to date.
The master drawing can be quite small because all it has to contain is pointers to the individual xref files.
This month we are going to explore drawings that seem to be the other way around. The xrefs attached to a master file might total many megabytes, but the objects actually displayed in the master drawing would seem to total only a few kilobytes.
Clip that Xref
It is possible to clip out part of an xref for display and then to have the master drawing ignore anything else in the xref. For example, you might have a master plot plan for a subdivision. As you create each house plan, you need to locate it within its own site plan. Rather than creating or copying the site plan information in each house drawing, you could simply use an xref to the master plan. You would then clip it as necessary to show just the individual site for the current house.
Similarly, a department layout drawing could reference part of an overall building drawing, and a machine assembly drawing could reference just the front view from a multiview component part drawing.
Start with a drawing that has an external reference attached, or create a new drawing and attach an xref to it (Figure 1).
|Figure 1: This master drawing contains a single xref. Click image for a larger version.|
Now start the XCLIP command by typing it in at the Command: prompt, or by selecting Modify | Clip | Xref from the menu bar or by selecting the Xclip button from the Reference toolbar or by picking the Clip Xref button from the Reference panel of the Blocks & References tab of AutoCAD 2009's ribbon menu, or you can select an xref insertion and then right-click and choose Xref Clip. Man, it's getting so that half of my column is taken up in just listing some of the alternate ways of starting a single command.
Select an xref insertion, and press Enter. The Xclip command then displays the following command options:
[ON/OFF/Clipdepth/Delete/generate Polyline/New boundary] <New>:
Press Enter again to accept the default of creating a New boundary, which then displays the following options:
[Select polyline/Polygonal/Rectangular/Invert clip] <Rectangular>:
Press Enter yet again to accept the default Rectangular mode. Xclip then asks for the two corners of a window. When you select the second corner, the command terminates, and the only portion of the xref that remains visible is the region within the clipping window that you specified (Figure 2).
|Figure 2: We have clipped using a rectangle, which suppresses everything outside the boundary. Click image for a larger version.|
That's it! Now that you have learned the basics of clipping an xref, let's look at some of the details.
Let's start when the Xclip command itself starts. I had you select an xref and then press Enter, but take a look at the fine print. The initial prompt asks you to select objects (plural). You can select multiple insertions of different xrefs. Later, when you define the clipping boundary, it will be applied to all of the selected xrefs in one hit.
The next thing to note is that the Xclip command not only creates clipping boundaries, but it also edits them. If you select an xref that has a clipping boundary already attached, then you can change many of the options. If you selected multiple xrefs initially, then each boundary is edited separately.
Now let's work through the other options. As usual in AutoCAD, you need to enter only the upper-case letter or letters to invoke an option. In addition, many of the options are also available as toolbar, menu, ribbon, or context-menu (right-click) options. Note that not all options are available all the time. For example, you obviously cannot delete a boundary if one doesn't yet exist.
- ON/OFF. If a selected xref already has a clipping boundary defined, you can turn it on or off. OFF does not delete the boundary definition, so you can flip back and forth at will.
- Clipdepth. If the xref includes 3D objects, you can clip anything in front of and/or behind the planes that you specify. You could thus clip one slice of bread out of a loaf.
- Delete. This deletes the boundary definition.
- Generate Polyline. Xclip normally just clips the xref as specified, as shown in Figure 1. This option generates a Pline, so your clipped region has a visible boundary line around it.
- <New> This is the default. You can just press Enter to proceed. If you have selected a previously clipped xref, you will be asked if you want to delete it. If you say No, then the command terminates because any given xref insertion can have only one clipping boundary at a time, but different insertions of the same xref can have different clipping boundaries.
If you are creating a New boundary, then the following options become available. Note also that object snaps are available during the specification process.
- <Rectangular> This is the default windowing method that we used initially.
- Select polyline. Select an existing polyline to use it as the boundary definition (Figure 3). It cannot cross over itself in a bowtie fashion, but it does not need to be closed. If it isn't closed, then Xclip adds an imaginary segment from the start to the end of the polyline to virtually close it. Polyline boundaries must end up containing straight-line segments only. If you use a filleted, splined, or curve fit polyline, or if it contains arc segments, then these objects will be approximated by a series of straight segments.
Polyline boundaries are not associative. If you edit or move the polyline then the clipped area will not update.
|Figure 3: We can also use an existing polyline as the clipping boundary, or we can specify a polygon fence on the fly. Click image for a larger version.|
- Polygonal. This option lets you specify a series of points on the fly. It then creates the clipping boundary as if you had created a polyline first and used it, and then deleted it (Figure 3).
- Invert clip. This is new to AutoCAD 2008. It reverses the action of the clipping boundary, so it cuts a hole in the xref instead of suppressing everything outside the boundary (Figure 4).
|Figure 4: The Invert mode in AutoCAD 2008 cuts a hole instead of clipping to the outside of the boundary. Click image for a larger version.|
This could be done previously only by creating a convoluted polygon path that completely surrounded the xref and then tunneled in to create the hole (Figure 5).
|Figure 5: The hard way of cutting a hole before AutoCAD 2008. Click image for a larger version.|
But Wait! There's More!
Yes, believe it or not, we have not yet covered all of the functionality and power of xrefs. Be sure to come back next month when we explore such exciting actions as unload, reload, detach, bind, and many more,
And Now for Something Completely Different
When you put your ski boat away for the winter, you should remember to remove the drain plug from the transom to get the last bit of water that the bilge pump misses. Now for the important part: leave the plug in the middle of the driver's seat so you are less likely to forget to replace it before you launch the boat next spring. You don't want to know how I know some of the things I know.