From 41227b89c8c07846c9b6a3ac486b8b1a6764dc1f Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Tue, 20 May 2025 12:43:39 +0500 Subject: [PATCH] Fix subtle bug with operators precedence in eabdb5d `+` has a higher precedence than `or`, so it resulted in the error below ``` Traceback (most recent call last): File "\bonsai\bim\module\spatial\prop.py", line 86, in update_active_container_index tool.Spatial.load_contained_elements() File "\bonsai\tool\spatial.py", line 312, in load_contained_elements cls.load_contained_elements_by_type(container) File "\bonsai\tool\spatial.py", line 321, in load_contained_elements_by_type results = cls.get_container_elements_grouped_by_type(container) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\bonsai\tool\spatial.py", line 294, in get_container_elements_grouped_by_type element_type.is_a() + "/" + element_type.Name or "Unnamed" ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ TypeError: can only concatenate str (not "NoneType") to str ``` --- src/bonsai/bonsai/tool/spatial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/tool/spatial.py b/src/bonsai/bonsai/tool/spatial.py index 1e67da47b5..20b2a4678d 100644 --- a/src/bonsai/bonsai/tool/spatial.py +++ b/src/bonsai/bonsai/tool/spatial.py @@ -291,7 +291,7 @@ class Spatial(bonsai.core.tool.Spatial): ifc_class = element.is_a() ifc_definition_id = element_type.id() if element_type else 0 type_name = ( - element_type.is_a() + "/" + element_type.Name or "Unnamed" + element_type.is_a() + "/" + (element_type.Name or "Unnamed") if element_type else f"Untyped {element.is_a()}" )