From 994ccb94f4d5a0dcf01c7835de5cad6695d923fa Mon Sep 17 00:00:00 2001 From: Jesusbill Date: Sun, 30 May 2021 13:32:59 +0200 Subject: [PATCH] fix bug in adding psets for materials --- src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py | 4 ++-- src/ifcopenshell-python/ifcopenshell/api/pset/data.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py b/src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py index 0a032b2a4e..e9cd52ddf6 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py +++ b/src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py @@ -43,8 +43,8 @@ class Usecase: self.settings["product"].HasPropertySets = has_property_sets return pset elif self.settings["product"].is_a("IfcMaterialDefinition"): - for definition in self.settings["product"].HasPropertySets or []: - if definition.Name == self.settings["name"]: + for definition in self.settings["product"].HasProperties or []: + if definition.Name == self.settings["Name"]: return definition return self.file.create_entity( diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset/data.py b/src/ifcopenshell-python/ifcopenshell/api/pset/data.py index e68f9394ef..0ea2bc6f21 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/pset/data.py +++ b/src/ifcopenshell-python/ifcopenshell/api/pset/data.py @@ -59,8 +59,9 @@ class Data: @classmethod def add_pset(cls, pset, product_id): data = pset.get_info() - del data["OwnerHistory"] - del data["HasProperties"] + if not pset.is_a("IfcMaterialProperties"): + del data["OwnerHistory"] + del data["HasProperties"] if hasattr(pset, "HasProperties"): props = pset.HasProperties or [] elif hasattr(pset, "Properties"):