mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
Previous logic always skipped the first point. Instead, it should only skip when actually closing a loop (i.e. >= 3 points). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -533,9 +533,12 @@ class Polyline(bonsai.core.tool.Polyline):
|
|||||||
polyline_data = polyline_data[0]
|
polyline_data = polyline_data[0]
|
||||||
polyline_points = polyline_data.polyline_points
|
polyline_points = polyline_data.polyline_points
|
||||||
if polyline_points:
|
if polyline_points:
|
||||||
# Avoids creating two points at the same location
|
# Avoids creating two points at the same location.
|
||||||
for point in polyline_points[1:]: # The first can be repeated to form a wall loop
|
# 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 (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"
|
return "Cannot create two points at the same location"
|
||||||
# Avoids creating overlapping edges
|
# Avoids creating overlapping edges
|
||||||
if len(polyline_points) > 1:
|
if len(polyline_points) > 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user