From 33f61ef3444e42303c15e477a01671d96355a6fa Mon Sep 17 00:00:00 2001 From: BelGraDev Date: Tue, 11 Aug 2026 11:04:27 +0200 Subject: [PATCH] Fixed error when accessing the UnitType attribute in convert_file_length_units --- src/ifcopenshell-python/ifcopenshell/util/unit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/unit.py b/src/ifcopenshell-python/ifcopenshell/util/unit.py index 910efcd186..3599aab3f5 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/unit.py +++ b/src/ifcopenshell-python/ifcopenshell/util/unit.py @@ -962,7 +962,7 @@ def convert_file_length_units(ifc_file: ifcopenshell.file, target_units: str = " ) unit_assignment = get_unit_assignment(file_patched) - unit_assignment.Units = [new_length, *(u for u in unit_assignment.Units if u.UnitType != new_length.UnitType)] + unit_assignment.Units = [new_length, *(u for u in unit_assignment.Units if getattr(u, 'UnitType', None) != new_length.UnitType)] if not file_patched.get_total_inverses(old_length): ifcopenshell.util.element.remove_deep2(file_patched, old_length)