From 69c197c1a4f047791befbae11e890be64026b7e7 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 22 May 2024 08:12:25 +1000 Subject: [PATCH] get_psets utility now defaults to merging duplicate psets instead of overriding This behaviour is more comprehensive for broken data and now consistent for types and materials. --- src/ifcopenshell-python/ifcopenshell/util/element.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/element.py b/src/ifcopenshell-python/ifcopenshell/util/element.py index c192e037e9..f0df9b16f5 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/element.py +++ b/src/ifcopenshell-python/ifcopenshell/util/element.py @@ -157,13 +157,13 @@ def get_psets( continue if qtos_only and not definition.is_a("IfcElementQuantity"): continue - psets[definition.Name] = get_property_definition(definition, verbose=verbose) + psets.setdefault(definition.Name, {}).update(get_property_definition(definition, verbose=verbose)) # NOTE: doesn't account for IFC2X3 missing HasProperties elif element.is_a("IfcMaterialDefinition") or element.is_a("IfcProfileDef"): for definition in getattr(element, "HasProperties", None) or []: if qtos_only: continue - psets[definition.Name] = get_property_definition(definition, verbose=verbose) + psets.setdefault(definition.Name, {}).update(get_property_definition(definition, verbose=verbose)) elif (is_defined_by := getattr(element, "IsDefinedBy", None)) is not None: # other IfcObjectDefinition if should_inherit: