You drew a shape. It looks like a closed shape. You select the polyline, type CLOSE, and AutoCAD draws a straight line from the last vertex directly to the first vertex -- right through the middle of your carefully drawn profile. That is not what you wanted. You undo, stare at the screen, and wonder why AutoCAD will not just close the shape properly.
Or maybe you have a different version of this problem: you have 48 individual line and arc segments that form a profile. You select them all, run PEDIT > Join, and AutoCAD says it joined 47 of 48 segments. One segment refused to join. The polyline is open, and somewhere in that boundary there is a gap that is preventing closure. Good luck finding it.
If either of these scenarios sounds familiar, you are not alone. Open polylines are one of the most common geometry issues in AutoCAD, and they cause problems far beyond aesthetics. Hatching fails. Area calculations are wrong. CNC toolpaths break. Extrusions in 3D produce unexpected results. Let me walk through why polylines stay open, the manual methods for closing them, the traps to avoid, and a more efficient approach for complex boundaries.
Why the CLOSE Command Does What It Does
First, let us clear up a misconception. The polyline CLOSE option does not "find the gap and fix it." It does something much simpler: it adds a straight-line segment from the last vertex of the polyline to the first vertex.
If your polyline's last vertex is at (50.0, 10.0) and the first vertex is at (0.0, 0.0), the CLOSE command draws a straight line from (50.0, 10.0) to (0.0, 0.0). If those two points happen to be adjacent -- meaning the last segment you drew ended right next to where the first segment started -- then CLOSE works perfectly. The straight line is tiny or zero-length, and the polyline closes properly.
But if your polyline traces a complex path and the last vertex is not adjacent to the first vertex, CLOSE draws a line that cuts across the interior of your shape. That is AutoCAD doing exactly what you asked. It just was not what you meant.
The real issue is that your polyline does not end where it started. There is a gap somewhere -- either between the last vertex and the first vertex, or at some junction along the path where segments were not properly connected. To close the polyline properly, you need to find that gap and eliminate it so that the polyline's path naturally returns to the starting point.
PEDIT JOIN: The First Thing Everyone Tries
When you have separate line and arc segments that should form a closed polyline, PEDIT with the Join option is the standard approach. Select all segments, join them into a single polyline, and then close it.
Here is how it works step by step:
- Type
PEDITand press Enter. - Type
Mfor Multiple and press Enter. - Select all the entities that form your boundary.
- Press Enter to confirm the selection.
- If any selected entities are not polylines, AutoCAD asks "Convert Lines, Arcs and Splines to polylines?" -- type
Y. - Type
Jfor Join and press Enter. - AutoCAD prompts for a fuzz distance (join tolerance). Enter
0for exact matching. - AutoCAD reports how many segments were joined.
If all segments join and the result is a closed polyline, congratulations. You are done. Verify by selecting the polyline and checking the Properties palette -- the Closed property should show "Yes."
If it reports that it joined fewer segments than you selected, there is a gap. AutoCAD joined everything it could find that was connected end-to-end, and then stopped when it hit a discontinuity. The segments that did not join are on the other side of the gap.
The problem: PEDIT JOIN tells you that a gap exists, but it does not tell you where. You know one or more segments failed to join, but you are looking at the same boundary that looked fine before you ran the command. Nothing has visually changed to help you locate the issue.
The BOUNDARY Command Approach
The BOUNDARY command (or BO) takes a different approach. Instead of joining existing entities, it creates a new polyline by tracing a boundary around the point you click. AutoCAD's boundary detection algorithm looks outward from the click point and follows the nearest entities to form an enclosure.
If it succeeds, you get a new closed polyline that represents the boundary. You can then use this polyline for hatching, area calculation, or whatever you needed the closed boundary for.
If it fails -- which it will if there is a gap -- it typically fails silently or creates a partial boundary. The failure gives you some information about where the gap might be (the boundary traces as far as it can before the gap), but the information is not precise enough to pinpoint the issue on a complex profile.
The BOUNDARY command also has a limitation: it only works with boundaries visible on screen. If your geometry extends beyond the current view, the boundary detection may not find the complete enclosure. Always zoom to show the full boundary before using this command.
Explode and Rejoin
If you have a polyline that is almost closed -- say, 47 of 48 segments joined -- sometimes exploding it back into individual segments and re-joining can produce a different result. This sounds like it should not help, and honestly, it often does not. But there are cases where the order of joining matters, and exploding resets the join sequence.
The more useful version of this approach is to explode the partial polyline, identify which segments are now separate (they are the ones on the "other side" of the gap), and then examine the connection points between the joined portion and the separate segments.
Steps:
- Note which segments PEDIT JOIN failed to include.
- Select the resulting polyline (the joined portion) and type
EXPLODE. - Now select just the segments that were previously separate and try to join them into their own polyline.
- You now have two polylines (or a polyline and some remaining segments). The gap is between the endpoint of one group and the start point of the other.
This narrows down the gap location from "somewhere in the boundary" to "between these two groups of segments." It is more information than PEDIT JOIN alone gives you, but it still requires you to visually locate the gap between the two groups.
FILLET with Radius 0
The FILLET command with a radius of 0 extends two entities to their intersection. If you have two line segments that almost meet at a corner, FILLET 0 closes the gap by extending both lines until they intersect.
For closing polylines, this is useful when you know where the gap is and it is a simple line-to-line connection. Select the first segment, select the second segment, and FILLET connects them.
Limitations:
- You need to know where the gap is first. FILLET does not find gaps; it only fixes them.
- FILLET 0 between a line and an arc, or between two arcs, can produce unexpected results. The mathematical intersection of a line and an arc may not be where you visually expect it.
- FILLET 0 on polyline segments works differently than on individual entities. You may need to explode the polyline first.
The Fuzz Factor Trap
When PEDIT JOIN with tolerance 0 does not join all segments, the temptation is to increase the fuzz distance. Set it to 0.01. Try 0.1. Try 1.0. Keep going until everything joins.
This is a trap, and I have seen it cause serious problems in production drawings. Here is why.
The fuzz distance tells AutoCAD to connect any endpoints that are within that distance of each other. When you set it to 0.1, AutoCAD will bridge any gap up to 0.1 units. It does this by moving one endpoint to match the other (or meeting in the middle, depending on the implementation).
On a machining drawing where tolerances are in the thousandths, moving an endpoint by 0.1 units is a dimensional change that could put a feature out of tolerance. You have "closed" the polyline, but you have also changed the geometry.
Worse, a fuzz distance of 0.1 on a drawing with multiple close-but-separate profiles might bridge gaps between profiles that are intentionally separate. Imagine two rectangular pockets that are 0.08 units apart. A fuzz distance of 0.1 joins them into one profile, merging two separate features.
The safe approach is to keep the fuzz distance as small as possible -- just enough to bridge the actual gap and nothing more. But to do that, you need to know how big the gap is, and to know that, you need to find it first.
Finding the Gap That Prevents Closure
So you have tried PEDIT JOIN and it failed. You know there is a gap. How do you find it?
The manual method
Turn on ENDPOINT osnap. Zoom into each junction of your boundary -- every place where one entity meets another. Hover your cursor at each junction and look for the ENDPOINT marker. If you see a single marker, the connection is good. If you see two markers slightly offset from each other, you found the gap.
On a simple profile with ten segments, this takes a few minutes. On a complex machining profile with 50, 100, or 200 segments, this takes a very long time. Each segment has two endpoints, and each endpoint needs to be checked against its neighbor. That is potentially hundreds of junction points to inspect.
And if the gap is a micro-gap -- 0.0005 units, for example -- you will not see it even when zoomed in. The two ENDPOINT markers overlap on screen. The gap is real, AutoCAD knows it is there (which is why PEDIT JOIN fails with tolerance 0), but the visual representation cannot show it.
The LIST method
Select each entity one by one and run the LIST command to see its start and end coordinates. Write down each endpoint. Compare adjacent endpoints. If two values do not match exactly, you found the gap.
This works, but it is painfully tedious. On a 50-segment boundary, you are writing down 100 coordinate pairs and comparing each pair to its neighbor. It is error-prone, and it takes a long time.
The automated method
This is the problem that GapDetector was built to solve. Select all the entities that form your boundary, run the scan, and the tool reports every gap -- including micro-gaps that are invisible to the eye. Each gap is shown with exact coordinates, exact size, and the specific entities involved.
For the "47 of 48 segments joined" scenario, GapDetector tells you exactly which two entities have the gap, exactly where the gap is, and exactly how big it is. Instead of checking 100 junctions manually, you go directly to the one that matters.
Fixing the Gap Once You Find It
Once you know where the gap is and how big it is, the fix depends on the situation.
For micro-gaps (under 0.01 units)
These are almost always precision errors, not intentional geometry. The fix is to move one endpoint to match the other. Select the entity, grip-edit the endpoint, and snap it to the adjacent entity's endpoint using ENDPOINT osnap.
Alternatively, use PEDIT JOIN with a fuzz distance that is just slightly larger than the gap. If the gap is 0.0003 units, a fuzz distance of 0.001 will bridge it without meaningfully altering the geometry. The key is knowing the exact gap size so you can set the tolerance appropriately.
For small gaps (0.01 to 1.0 units)
These might be precision errors or they might be actual drafting mistakes -- a line that was drawn slightly short, an arc that does not quite reach the next segment. Use FILLET 0 for line-to-line junctions, or EXTEND to push a segment to the intersection point.
Before fixing, consider whether the gap is at a dimensioned feature. If a line is 0.05 units short of the intersection and that line has a dimension, extending it changes the dimension. You might need to adjust adjacent geometry to maintain the design intent.
For gaps from missing segments
Sometimes the gap is not between two close endpoints -- it is a genuine missing segment. A line or arc was deleted or never drawn. In this case, you need to draw the missing segment, snapping to the endpoints of the adjacent entities on either side of the gap.
After fixing
After you fix the gap, try PEDIT JOIN again. If it now joins all segments, check that the polyline is closed (Properties > Closed = Yes). If it is not closed, the CLOSE option should now work correctly because the polyline path returns to its starting point.
If PEDIT JOIN still fails, run another gap check. Sometimes fixing one gap reveals another one that was previously masked -- both gaps were in the same region, and fixing the obvious one reveals a second, smaller gap nearby.
Preventing Open Polylines
The best approach is to avoid creating open polylines in the first place. A few habits make a big difference.
Draw polylines as polylines. If you know the boundary needs to be a closed polyline, draw it as a polyline from the start using the PLINE command. When you finish drawing, use the Close option before ending the command. This guarantees a closed polyline with no gaps.
Use OSNAP religiously. Keep ENDPOINT osnap active at all times. Every time a new segment starts, snap to the endpoint of the previous segment. This eliminates nearly all gaps at junctions.
Be careful with OFFSET. Offsetting a closed polyline should produce another closed polyline, but in practice, the result sometimes has small gaps at arc-line transitions. Check the offset result by verifying it is closed in Properties.
Be careful with TRIM and EXTEND. Trimming a polyline segment can open it. If you trim a segment of a closed polyline, the polyline becomes open at the trim location. You then need to re-close it, which might require adding a new segment or using FILLET.
Check after file conversion. Importing DXF files, opening DWG files from other CAD systems, and converting file formats can introduce gaps. After any file conversion, check that boundaries that should be closed are actually closed.
When You Have Hundreds of Polylines to Check
Everything above assumes you are working with one polyline at a time. But what about drawings with dozens or hundreds of profiles -- a nesting layout, a multi-part assembly drawing, or a large site plan?
Manual checking does not scale. Checking one polyline takes 5-10 minutes with the zoom-and-inspect method. Checking 50 polylines takes all day.
GapDetector scans everything you select in a single pass. Select all geometry on the cutting layer, run the check, and get a report for every gap in every boundary. Fix the flagged issues, re-scan to confirm, and move on. The per-polyline time drops from minutes to seconds.
Wrapping Up
Open polylines are a solvable problem. The real challenge is not the fix itself -- it is finding the gap that needs to be fixed. On simple geometry, manual methods work fine. Turn on ENDPOINT osnap, zoom around, find the two endpoints that do not meet, connect them, done.
On complex geometry with dozens or hundreds of segments, or on micro-gaps that are invisible no matter how far you zoom in, manual detection is not practical. You need a tool that checks every endpoint against every adjacent endpoint and tells you exactly where the connections fail.
Either way, stop using the CLOSE command as a fix for open polylines. It does not fix gaps -- it just adds a line from the last vertex to the first. Find the actual gap, fix the actual gap, and then the polyline closes properly on its own.