mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-16 10:34:31 +00:00
Handle RuntimeError in alignment geometry generation
Add RuntimeError handling for IfcOpenShell versions that don't support the piecewise-step-type setting in geometry generation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -308,7 +308,8 @@ class Alignment:
|
||||
# Generate vertices using IfcOpenShell's geometry engine
|
||||
try:
|
||||
vertices = align_util.generate_vertices(rep_curve, distance_interval=1.0)
|
||||
except (ValueError, NotImplementedError):
|
||||
except (ValueError, NotImplementedError, RuntimeError):
|
||||
# RuntimeError can occur if IfcOpenShell version doesn't support certain settings
|
||||
return None
|
||||
|
||||
if len(vertices) < 2:
|
||||
|
||||
@@ -90,7 +90,10 @@ def generate_vertices(rep_curve: entity_instance, distance_interval: float = 5.0
|
||||
)
|
||||
|
||||
s = ifcopenshell.geom.settings()
|
||||
s.set("piecewise-step-type", 0) # 0 = step-size is maximum step size, 1 = step-size is mininimum number of steps
|
||||
try:
|
||||
s.set("piecewise-step-type", 0) # 0 = step-size is maximum step size, 1 = step-size is mininimum number of steps
|
||||
except RuntimeError:
|
||||
pass # Setting not available in older IfcOpenShell versions
|
||||
s.set("piecewise-step-size", distance_interval)
|
||||
shape = ifcopenshell.geom.create_shape(s, rep_curve)
|
||||
vertices = shape.verts
|
||||
|
||||
Reference in New Issue
Block a user