From e670a7ca71ada0636885d6c39838ba15cfb77895 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 26 Jun 2024 11:33:04 +1000 Subject: [PATCH] See #4826. If a Qto calculator returns none, don't fail There can be valid reasons for this, such as if the calculator realises it cannot compute a value (e.g. no mass density when calculating weight) --- src/ifc5d/ifc5d/qto.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ifc5d/ifc5d/qto.py b/src/ifc5d/ifc5d/qto.py index 5f54dc2481..f7c8febcc0 100644 --- a/src/ifc5d/ifc5d/qto.py +++ b/src/ifc5d/ifc5d/qto.py @@ -265,9 +265,10 @@ class Blender: continue if not (formula_function := formula_functions.get(formula)): formula_function = formula_functions[formula] = getattr(calculator, formula) - results[element][name][quantity] = unit_converter.convert( - formula_function(obj), Blender.functions[formula].measure - ) + if (value := formula_function(obj)) is not None: + results[element][name][quantity] = unit_converter.convert( + value, Blender.functions[formula].measure + ) calculators = {"Blender": Blender, "IfcOpenShell": IfcOpenShell}