From c3bfd7354f600267f38fa3b112d8f445a5c72031 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 13 May 2024 16:16:04 +0500 Subject: [PATCH] pset.add_pset - throw an error if entity doesn't support adding a pset --- src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py b/src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py index d28fe9b16d..349a1fa85f 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py +++ b/src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py @@ -61,6 +61,9 @@ def add_pset(file: ifcopenshell.file, product: ifcopenshell.entity_instance, nam that prefix. It is recommended to use your own prefix tailored to your project, company, or local government requirement. :type name: str + + :raises TypeError: If `product` class doesn't support adding a pset. + :return: The newly created IfcPropertySet :rtype: ifcopenshell.entity_instance @@ -154,3 +157,5 @@ def add_pset(file: ifcopenshell.file, product: ifcopenshell.entity_instance, nam kwargs["Name"] = settings["name"] return file.create_entity("IfcProfileProperties", **kwargs) + + raise TypeError(f"Class '{settings['product'].is_a(True)}' doesn't support adding a property set.")