From f06873d24e9ac31d0d3821f761e8288045f41007 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 13 Feb 2026 09:57:51 +1100 Subject: [PATCH] Remove try except blocks, rename piecewise-step to function-step, remove settings where default suffices --- src/bonsai/bonsai/tool/alignment.py | 15 +-------------- .../ifcopenshell/api/alignment/util.py | 9 +-------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/src/bonsai/bonsai/tool/alignment.py b/src/bonsai/bonsai/tool/alignment.py index 10a3803563..6799dcd156 100644 --- a/src/bonsai/bonsai/tool/alignment.py +++ b/src/bonsai/bonsai/tool/alignment.py @@ -306,14 +306,6 @@ class Alignment: # This handles negative-length curve segments correctly at the C++ level try: s = ifcopenshell.geom.settings() - try: - s.set("piecewise-step-type", 0) # step-size is maximum step size - except RuntimeError: - pass - try: - s.set("piecewise-step-size", distance_interval) - except RuntimeError: - pass shape = ifcopenshell.geom.create_shape(s, curve_segment) verts = shape.verts @@ -462,12 +454,7 @@ class Alignment: return None # Generate vertices using IfcOpenShell's geometry engine - try: - vertices = align_util.generate_vertices(rep_curve, distance_interval=1.0) - except (ValueError, NotImplementedError, RuntimeError) as e: - # RuntimeError can occur if IfcOpenShell version doesn't support certain settings - print(f"[Alignment] generate_vertices failed: {e}") - return None + vertices = align_util.generate_vertices(rep_curve, distance_interval=1.0) if len(vertices) < 2: print(f"[Alignment] Not enough vertices ({len(vertices)}), need at least 2") diff --git a/src/ifcopenshell-python/ifcopenshell/api/alignment/util.py b/src/ifcopenshell-python/ifcopenshell/api/alignment/util.py index c82abef50a..7b4a0f1b71 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/alignment/util.py +++ b/src/ifcopenshell-python/ifcopenshell/api/alignment/util.py @@ -100,14 +100,7 @@ def generate_vertices(rep_curve: entity_instance, distance_interval: float = 5.0 ) s = ifcopenshell.geom.settings() - try: - s.set("piecewise-step-type", 0) # 0 = step-size is maximum step size, 1 = step-size is mininimum number of steps - except RuntimeError: - print("[util.py] piecewise-step-type setting not available, skipping") - try: - s.set("piecewise-step-size", distance_interval) - except RuntimeError: - print("[util.py] piecewise-step-size setting not available, skipping") + s.set("function-step-param", distance_interval) shape = ifcopenshell.geom.create_shape(s, rep_curve) vertices = shape.verts if len(vertices) == 0: