From 4109b19c3a5ac43d070b692ede7f47b729df37cc Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 9 Mar 2025 18:31:43 +1100 Subject: [PATCH] See #1227. Slightly more defensive to make sure ATPATH is between START and END --- .../api/geometry/regenerate_wall_representation.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/regenerate_wall_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/regenerate_wall_representation.py index 5f72756c56..06d2d2720b 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/regenerate_wall_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/regenerate_wall_representation.py @@ -240,7 +240,13 @@ class Regenerator: else: # A wall footprint may be multiple profiles if the wall is split into two due to an ATPATH connection profiles = [] - split_points = sorted(self.split_points, key=lambda x: x[0][0]) # Sort islands in the +X direction + minx = max([p[0] for p in self.start_points]) + maxx = min([p[0] for p in self.end_points]) + split_points = [] + for points in sorted(self.split_points, key=lambda x: x[0][0]): # Sort islands in the +X direction + if any([p[0] > maxx or p[0] < minx for p in points]): # Can't have anything outside our start/end + continue + split_points.append(points) start_points = [p.copy() for p in self.start_points] end_points = [p.copy() for p in self.end_points] split_points.insert(0, start_points) @@ -259,7 +265,7 @@ class Regenerator: maxy_maxx = end_split[-1][0] miny_minx = start_split[0][0] miny_maxx = end_split[0][0] - # Do more defensive checks here + # Do more defensive checks here? points = start_split remaining_path_points = []