mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
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
```
This commit is contained in:
@@ -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()}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user