From c73409e4ca0afd86e0623bcd0ea7378940942819 Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Thu, 16 Jul 2026 15:00:02 +0300 Subject: [PATCH] Bonsai: fix missing closing edge when importing a closed IfcPolyline profile for editing (#6930) tool.Model.convert_curve_to_mesh() builds the editable Blender mesh for an IfcArbitraryClosedProfileDef's OuterCurve. For a closed IfcPolyline (first and last point coincide), it correctly drops the duplicate closing point, then tried to reconnect the loop by overwriting the last entry of cls.edges with the closing edge (N-1, 0) instead of appending it. Since the preceding edge list already contained exactly N-1 edges for the N points added (one edge per consecutive pair, no placeholder), that assignment clobbered the real edge between the last two profile vertices rather than adding the missing closing edge, leaving the profile item open by one edge whenever you entered Direct Profile Edit (bim.direct_profile_edit) on an IfcExtrudedAreaSolid/IfcArbitraryClosedProfileDef item, matching the "resultant profile is not fully closed" behaviour reported in #6930. Append the closing edge instead of overwriting the last one, matching the sibling IfcIndexedPolyCurve closed-loop handling a few lines below, which already appends correctly. Generated with the assistance of an AI coding tool. --- src/bonsai/bonsai/tool/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/tool/model.py b/src/bonsai/bonsai/tool/model.py index f54633c3cc..188f62244f 100644 --- a/src/bonsai/bonsai/tool/model.py +++ b/src/bonsai/bonsai/tool/model.py @@ -618,7 +618,7 @@ class Model(bonsai.core.tool.Model): cls.edges.extend([(i, i + 1) for i in range(offset, len(cls.vertices) - 1)]) if is_closed: - cls.edges[-1] = (len(cls.vertices) - 1, offset) # Close the loop + cls.edges.append((len(cls.vertices) - 1, offset)) # Close the loop elif curve.is_a("IfcCompositeCurve"): # This is a first pass incomplete implementation only for simple polylines, and misses many details.