Playing with Polylines, Part 215 Dec, 2004 By: Bill Fane Cadalyst
The more you edit a pline, the more its appearance changes
Last month we got you started in the wonderful world of polylines as we played with the subtleties and nuances of the Pline command. (Click here to view that column.)
As promised, this month we will be jumping in to make some changes to existing plines.
Start by drawing a polyline consisting of several segments. Do not close it back on itself, but leave it as an open polyline (figure 1).
Figure 1. A plain, simple, open polyline.
Get a Grip
Let's start with the really easy method of editing a polyline. If you click on a polyline while no command is active, then as usual AutoCAD invokes grip editing. Also as usual, the default mode for grip editing is Stretch. You can simply click on one of the grips that appear at each vertex of the polyline, then drag it to a new location (figure 2).
Figure 2. Grip editing can be used to drag vertices to new locations.
Not unexpectedly, you can press the space bar during a grip edit to toggle through a range of options. Polyline grip editing behaves almost exactly like grip editing on any other object:
- Stretch moves the selected vertex.
- Move moves the entire polyline as a unit.
- Rotate rotates the entire polyline about the selected vertex.
- Scale lets you shrink or enlarge the polyline, using the selected vertex as the base point.
- Mirror mirrors the entire polyline. The selected vertex defines one end of the mirror line.
Offset. The Offset command will produce a new, single polyline wherein each segment runs exactly parallel to the original polyline segments, regardless of the twists and turns the polyline takes (figure 3). Any width information in the original is carried into the second line.
Figure 3. The Offset command produces a parallel copy of a polyline.
Fillet. The Fillet and Chamfer commands will also operate on a polyline in two different modes. To see the first mode, start Fillet and specify a suitable radius. When prompted to select the first object, pick a segment of the polyline. When prompted to select the second object, pick an adjacent segment and a fillet will be applied (figure 4).
Figure 4. You can fillet adjacent segments of a polyline.
If you pick two nonadjacent segments, one of two things happens. If there is more than one intervening segment, AutoCAD will object and will exit the command. On the other hand, if there is only one intervening segment, then it is replaced by a tangent arc, regardless of the fillet radius setting (figure 5).
Figure 5. The result of filleting two nonadjacent polyline segments.
Now let's look at the other filleting mode.
Start the Fillet command and specify a suitable radius. Now enter a P, then select a polyline. You'll see how a fillet of the specified radius is applied to every vertex (figure 6).
Figure 6. You can fillet every vertex in one operation.
Chamfer. It should come as no surprise that the Chamfer command operates on a polyline in exactly the same manner as does Fillet.
Divide, Measure, Extend, Trim, and Break. Similarly, the Divide and Measure commands ignore the vertices and work down the full length of a polyline as if it were stretched out to be a single, straight line.
Extend, Trim, and Break operate on a polyline exactly as they do on a regular line or arc, and a polyline can be the boundary for any trim or extend operation. In any case, width is ignored and the operation takes place at the centerline of the polyline.
Explode. There is one more editing command that also works on a polyline. Remember last month when I said that a polyline behaved as though you had made a block out of a collection of regular lines and arcs? Well, the Explode command will indeed break up a polyline into a bunch of discrete lines and arcs. Any width information will be lost, however.
A Valuable Property
Figure 7. AutoCAD's Properties button, found in the standard toolbar.
If you started the Properties command by any method other than double-clicking on a polyline, then you will have to single-click on one to specify which one you want to edit. In any case, the Properties dialog box appears (figure 8).
Figure 8. The Properties dialog box for a selected polyline.
Let's start with the General section at the top. As you can see, you can change all the common properties such as the layer, linetype scale, and thickness. You can also change the linetype and color, but following good CAD practice these two properties are usually controlled by layer. Thickness refers to 3D thickness in the Z direction. Lineweight is usually not applicable, because polylines can have a specific width.
The Last Shall be First
Now let's look at the Geometry section of the Properties dialog box. In a flash of pure logic, I will move from the bottom up.
The last two entries cannot be edited directly. They indicate the total length and the surrounded area of the polyline. You may well ask, "How can an open polyline can enclose an area?" Easy: AutoCAD assumes there is one more invisible segment joining the two ends of the polyline.
Elevation is a 3D option. It allows you to move the entire polyline upward in the Z direction of the current coordinate system.
As it implies, Global Width lets you change the width of the entire polyline. AutoCAD updates the polyline as soon as you enter a value so you can see the result.
And the First Shall be Toward the End
Now we come to the interesting bit. The top five windows under the Geometry section are unique to polyline editing.
Click on the Vertex window. Several things happen (figure 9). An X appears on the first vertex of the polyline, left and right arrows appear at the right end of the Vertex window, and the current values for this vertex appear in the next four windows.
Figure 9. Click on the Vertex window to edit individual vertex properties.
You can change any of the four values, and you can click on the Vertex arrows to scroll forward and backward through the polyline one vertex at a time. Figure 10 shows the result of editing the fifth vertex. I changed all four properties for this vertex.
Figure 10. You can edit a polyline one vertex at a time.
The Misc section of the editing dialog box contains only two options. The first one will close an open polyline by adding one more segment from the end back to the start. Note that this is different than in Canadian grammar textbooks it says one should always use "different from" rather than "different than". simply selecting the last vertex to coincide with the first. A closed polyline that has width will miter properly at the start/end junction. Conversely, if you are editing a closed polyline, then this window will allow you to open it by deleting the last segment.
The final window involves noncontinuous linetypes. If you disable this function, AutoCAD assumes that each segment is effectively a separate object, and so noncontinuous linetypes start their pattern over again at each vertex. If enabled, then AutoCAD generates noncontinuous linetypes as though the polyline were one long line without any segments. It ignores the vertices.
But Wait -- There's More!
The foregoing list by no means exhausts the possible changes that can be made to a polyline. To do any other editing to a polyline there is a specific command called Pedit (for PolylineEdit). This column is getting a little long, so be sure to come back next month when I'll finish off the topic of polyline editing.
And Now for Something Completely Different
Paint spatters can be very difficult to safely remove from plastic eyeglass lenses. If you are painting a ceiling, buy an inexpensive snorkeling mask or plastic safety goggles. They will prevent the paint spatters from getting on your glasses to begin with.
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!