From 620dc4741dcad25235bf940d2954d5b63fde8167 Mon Sep 17 00:00:00 2001 From: Chris Mackey Date: Sat, 19 Oct 2024 15:27:16 -0400 Subject: [PATCH] fix(faces): Ensure degenerate geometry is caught for all split methods --- ladybug_geometry/geometry3d/face.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ladybug_geometry/geometry3d/face.py b/ladybug_geometry/geometry3d/face.py index 2701013c..a5146921 100644 --- a/ladybug_geometry/geometry3d/face.py +++ b/ladybug_geometry/geometry3d/face.py @@ -1217,8 +1217,11 @@ def split_with_line(self, line, tolerance): if len(cycle) >= 3: pt_3ds = [prim_pl.xy_to_xyz(node.pt) for node in cycle] new_face = Face3D(pt_3ds, plane=prim_pl) - new_face = new_face.remove_colinear_vertices(tolerance) - split_faces.append(new_face) + try: + new_face = new_face.remove_colinear_vertices(tolerance) + split_faces.append(new_face) + except AssertionError: # degenerate geometry to ignore + pass # rebuild the Face3D from the results and return them if len(split_faces) == 1: @@ -1279,8 +1282,11 @@ def split_with_polyline(self, polyline, tolerance): if len(cycle) >= 3: pt_3ds = [prim_pl.xy_to_xyz(node.pt) for node in cycle] new_face = Face3D(pt_3ds, plane=prim_pl) - new_face = new_face.remove_colinear_vertices(tolerance) - split_faces.append(new_face) + try: + new_face = new_face.remove_colinear_vertices(tolerance) + split_faces.append(new_face) + except AssertionError: # degenerate geometry to ignore + pass # rebuild the Face3D from the results and return them if len(split_faces) == 1: