BIM

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. We measured the join command, the PEDIT route, and the case with a gap.

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

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 measures how to merge those four lines, including the awkward case where a gap is left between two of them, on AutoCAD 2027 at the Institute. For the whole discipline of accurate drafting, see the AutoCAD for Construction course.

Polylines in AutoCAD are one object, not several lines

We drew 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. Our machine measured 0, a thin line. We set it to 30, drew again, and the new object carried 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. We measured three situations and the results 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 we opened with. We drew a square 2000 by 1500 from four loose lines, merged them, and measured.

Four loose lines and one polyline Photo: 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
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". We measured it, and 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. We drew 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.

Three things often repeated that are not true

Often repeatedWhat we measured on the 2027 release
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. We measured it, and 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