mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user