From 0f3de599a6f2a7e67a65e5167f372e908e4f71e8 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 26 Feb 2025 13:13:22 +1100 Subject: [PATCH] Don't break if no area unit defined --- src/bonsai/bonsai/bim/module/drawing/helper.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/drawing/helper.py b/src/bonsai/bonsai/bim/module/drawing/helper.py index 5a46b8e27b..a9333fb6a4 100644 --- a/src/bonsai/bonsai/bim/module/drawing/helper.py +++ b/src/bonsai/bonsai/bim/module/drawing/helper.py @@ -137,9 +137,10 @@ def format_distance( scaleFactor = bpy.context.scene.unit_settings.scale_length unit_system = bpy.context.scene.unit_settings.system unit_length = bpy.context.scene.unit_settings.length_unit - area_unit_symbol = " " + ifcopenshell.util.unit.get_unit_symbol( - ifcopenshell.util.unit.get_project_unit(tool.Ifc.get(), "AREAUNIT") - ) + if area_unit := ifcopenshell.util.unit.get_project_unit(tool.Ifc.get(), "AREAUNIT"): + area_unit_symbol = " " + ifcopenshell.util.unit.get_unit_symbol(area_unit) + else: + area_unit_symbol = "" value *= scaleFactor