AutoCAD – Drawings

Polylines in AutoCAD: four loose lines into one object with an area

Polylines in AutoCAD turn loose lines into one object that reports an area. The join command, the PEDIT route, and the case where a gap is left.

  • TS. Đỗ Quốc Hoàng
  • 11 min read
Two identical squares, one made of four loose lines and one a single object that reports an area Photo: AutoCAD 2027

You need the area of a site boundary that is already drawn. You click it and get four loose lines and no number at all. That boundary has to be one of the polylines in AutoCAD before the program will report an area.

This article covers how to merge those four lines, including the awkward case where a gap is left between two of them, on AutoCAD 2027. For the whole discipline of accurate drafting, see the AutoCAD for Construction course.

Where to start: three commands and their entry points

Three commands appear in this article. Their entry points are read straight out of the 2027 configuration files.

JobFull commandAliasRibbonClassic menuToolbar
Draw a new onePLINEPLHome → Draw → PolylineDraw → PolylineDraw → Polyline
Merge and editPEDITPEHome → Modify → Edit PolylineModify → Object → PolylineModify II → Edit Polyline
Join collinear linesJOINJHome → Modify → JoinModify → JoinModify → Join

PL and PE are the two aliases worth learning by heart. The ribbon button for PEDIT sits inside the Modify panel's drop-down, behind the little arrow, so typing the alias stays quicker.

The prompts, step by step

Drawing a new polyline is easy; merging a set of loose lines is the job people actually struggle with. Below is one complete run of PE, with the middle column copied verbatim from the 2027 release.

StepWhat the program asksWhat you do
1Select polyline or [Multiple]:Type M and press Enter
2Select objects:Window the whole set, then press Enter
3Convert Lines, Arcs and Splines to polylines [Yes/No]? <Y>Press Enter to accept Y
4Enter an option [Close/Open/Join/Width/Fit/Spline/Decurve/Ltype gen/Reverse/Undo]:Type J and press Enter
5Enter fuzz distance or [Jointype] <0.0>:Press Enter if the lines touch
6Enter an option [Close/Open/Join/...]:Press Enter to leave the command

The three places people give up are all in that table.

Step 1 requires the M. Skip it and the command edits one object only, which is exactly why people conclude it cannot merge a set.

Step 3 must be answered Y. A line is not yet a polyline, and without the conversion there is nothing to join.

Step 5 is the deciding one when gaps are left between the lines, and we measure it separately below.

Polylines in AutoCAD are one object, not several lines

Drawing a three-point path with the pline command and read back the object it produced. The alias is PL, two keystrokes, which is why it is worth making the habit.

MeasurementResult
Object typeLWPOLYLINE
Vertices3
Width0
PLINETYPE2

Three points, two segments, and only one object. That is the whole difference from the ordinary line command, which creates a separate object for every segment. How that command behaves is covered in our article on drawing straight lines.

The prompt, copied verbatim from the 2027 release, shows at once what this command can do that the line command cannot.

Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:

Arc switches to drawing a tangent arc inside the same object, Close closes the shape, and Width changes the polyline width. That arc option is the one worth learning first: a run of straights and curves that would otherwise be five separate objects stays a single one, and it keeps its area and perimeter throughout.

When the line comes out thick: the culprit is PLINEWID

A very common complaint, and the measurement is short.

PLINEWID holds the default width of the polyline about to be drawn. It reads 0, a thin line. Set it to 30, draw again, and the new object carries a width of exactly 30.

PLINEWIDWidth recorded in the object
00
3030

So a suddenly fat line is nothing broken. Somebody, or the Width option during an earlier run, set that variable away from zero. Type PLINEWID, enter 0, and normal service resumes.

A line already drawn is fixed with the polyline edit command, choosing Width and entering 0.

What the join command accepts and what it refuses

Plenty of tutorials say this command only works on objects drawn with the polyline command. Three situations say otherwise.

SituationWhat the program answeredResult
Two collinear lines, touching1 line joined to sourceone line left
Two collinear lines, 50 apart1 line joined to sourceone line left
Three lines meeting at right angles0 lines joined to source, 2 objects discarded from the operationstill three lines

The first two rows show the command works perfectly well on ordinary lines, and even bridges a gap with nothing extra to declare. The third row is the real limit: the pieces must lie on the same straight line. Turn a corner and it refuses, and the program says plainly that two objects were discarded from the operation.

One more detail worth remembering: what you get back is still a line, not a polyline. For a polyline you need the command in the next section.

The pedit command converts a whole set at once

This is the command that solves the problem this article opened with. Drawing a square 2000 by 1500 from four loose lines, merged them, and measured.

Two squares drawn identically. Left: four loose lines, counted by machine as 4 objects. Right: after merging, a single closed polyline whose area the program reports as 3000000, exactly 2000 times 1500 Photo: AutoCAD 2027
MeasurementBeforeAfter
Objects41
Object typeLINELWPOLYLINE
Area reportednone3000000

The 3000000 checks immediately: 2000 times 1500. The program also printed 3 segments added to polyline, meaning three lines were absorbed into the first.

The sequence is five beats. Type PE, choose Multiple, window the whole set, press Enter, then answer Y to the conversion question and choose Join.

The Multiple option is the part most tutorials leave out, and without it the command edits one object at a time, which is why people conclude it does not work on a set.

Two prompts are worth copying verbatim, because they are where people give up halfway.

Convert Lines, Arcs and Splines to polylines [Yes/No]? <Y>

Enter fuzz distance or [Jointype] <0.0>:

The first asks whether to convert lines into polylines; answer Y. The second asks for the tolerated gap, and that is the subject of the next section.

A small gap: raising the fuzz distance is only half the answer

The familiar advice is "just raise the fuzz distance until it joins". That advice is missing half of itself.

Two collinear lines with a gap of exactly 50 between them. Fuzz set to 100, comfortably more than the gap. Then each of the three join methods the command offers.

Join methodWhat the program answeredResult
Extend, the default0 segments added to polylinestill two objects
Add2 segments added to polylineone object
Both2 segments added to polylineone object

That first row is where people give up: the fuzz is plenty and still nothing joins. The reason sits in Autodesk's own description on the PEDIT page. Extend is "Joins the selected polylines by extending or trimming the segments to the nearest endpoints."

Two segments lying on the same straight line have no intersection to extend to. We confirmed that with a control: two segments at different angles, with the same kind of gap, joined immediately under Extend, and the program printed 1 segments added to polyline.

So the rule shortens to this. Segments that turn a corner need nothing but the default; collinear segments with a gap need Add or Both, which Autodesk describes as "Joins the selected polylines by adding a straight segment between the nearest endpoints."

What you gain once the lines are merged into polylines in AutoCAD

Merging is not tidiness for its own sake. Four gains, each either measured or immediately visible.

An area and a perimeter you can read. This is the biggest one on a construction drawing, and it is the 3000000 in the table above.

One click selects the whole boundary. A set of loose lines has to be windowed, and it is easy to miss a segment without noticing.

Filleting and chamfering the whole run at once. Both are covered in our article on the fillet command.

A width that belongs to the object, instead of changing the lineweight of a whole layer.

A fifth gain is worth naming for anyone producing a drawing set rather than a single sheet. Hatching, area schedules and quantity takeoffs all want a closed boundary, and a set of loose lines will either be refused or, worse, accepted with a boundary the program guessed at. Merging first removes a whole class of quiet errors that surface only at the end.

Against that, editing one segment on its own becomes fiddlier, and housekeeping on a drawing with very many objects is a separate subject, covered in our article on slimming down a CAD drawing.

There is always a way back. Drawing a closed four-sided polyline, exploded it, and counted exactly 4 lines, with the polyline itself gone from the drawing. Merging and exploding are a two-way street, but the area goes when you explode, because four loose lines carry no such information.

Other names people use for joining lines

The same job goes by several names: joining lines, merging segments, or converting a line to a pline. pline is simply the PL alias of the polyline command, so converting a line to a pline and converting it to a polyline are one and the same.

Which command to use depends on what you have.

What you haveWhat you wantUse
two collinear segmentsone straight lineJOIN
a set of segments meeting at cornersone polylinePE, option Multiple then Join
a single arca closed circleJOIN then the cLose option

The second prompt of JOIN changes with the type of the first object you pick, and that is what confuses people. Copied verbatim from the 2027 release:

Source objectWhat it asks next
a lineSelect lines to join to source:
an arcSelect arcs to join to source or [cLose]:

Pick a line as the source and it will only take more lines; pick an arc and it will only take more arcs. Mix the two and nothing joins, with no error message at all.

JOIN bridges a gap rather than ignoring it. Two 1500-long collinear lines with a 500 gap between them: type JOIN, the program answers 1 line joined to source, and measuring what is left gives exactly 3500.

The cLose option is the one few people know. Pick an arc as the source and type L; AutoCAD prints Arc converted to a circle. and the arc becomes a closed circle, which is quicker than drawing a new circle and deleting the arc.

An ordinary polyline has one elevation for the whole line. A route whose level changes at every vertex needs 3DPOLY; see 3D polylines in AutoCAD.

Three things often repeated that are not true

Often repeatedWhat the 2027 release actually does
The join command only works on polylinesIt joined two ordinary lines, even with a gap of 50
The join command will merge lines that turn a cornerThe program answered 0 lines joined to source and discarded two objects
With a gap, just raise the fuzz distanceThe default Extend still answered 0 segments added; you must switch to Add

Frequently asked questions

Why does selecting a boundary give me no area?

Because it is a set of loose lines rather than one polyline. Merge them with PE, the Multiple option and then Join, and the area becomes readable.

How do I fix a line that comes out thick?

Type PLINEWID and enter 0. The width recorded in the object equals the value of that variable at the moment of drawing.

How do the join command and the pedit command differ?

JOIN merges only pieces lying on the same straight line and hands back a line. PE merges a whole set that turns corners and hands back a polyline.

There is a tiny gap and nothing joins.

Go into the Jointype option and choose Add or Both before entering the tolerated gap. The default method cannot join two collinear segments.

Can I split a merged polyline again?

Yes, with EXPLODE. We exploded a four-sided polyline and counted exactly 4 lines. The area goes with it.

About the author

TS. Đỗ Quốc Hoàng — Vice Director of the Institute of Information Technology in Civil Engineering, Hanoi University of Civil Engineering, and a specialist in software development for construction