diff --git a/src/bonsai/bonsai/tool/polyline.py b/src/bonsai/bonsai/tool/polyline.py index 5a91fc79b8..542bc23005 100644 --- a/src/bonsai/bonsai/tool/polyline.py +++ b/src/bonsai/bonsai/tool/polyline.py @@ -533,9 +533,12 @@ class Polyline(bonsai.core.tool.Polyline): polyline_data = polyline_data[0] polyline_points = polyline_data.polyline_points if polyline_points: - # Avoids creating two points at the same location - for point in polyline_points[1:]: # The first can be repeated to form a wall loop + # Avoids creating two points at the same location. + # The only exception is repeating the first point to close a loop (requires >= 3 existing points). + for i, point in enumerate(polyline_points): if (x, y, z) == (point.x, point.y, point.z): + if i == 0 and len(polyline_points) >= 3: + continue return "Cannot create two points at the same location" # Avoids creating overlapping edges if len(polyline_points) > 1: