Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit c3bfd73

Browse files
committed
pset.add_pset - throw an error if entity doesn't support adding a pset
1 parent 1d046ea commit c3bfd73

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • src/ifcopenshell-python/ifcopenshell/api/pset

src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ def add_pset(file: ifcopenshell.file, product: ifcopenshell.entity_instance, nam
6161
that prefix. It is recommended to use your own prefix tailored to
6262
your project, company, or local government requirement.
6363
:type name: str
64+
65+
:raises TypeError: If `product` class doesn't support adding a pset.
66+
6467
:return: The newly created IfcPropertySet
6568
:rtype: ifcopenshell.entity_instance
6669
@@ -154,3 +157,5 @@ def add_pset(file: ifcopenshell.file, product: ifcopenshell.entity_instance, nam
154157
kwargs["Name"] = settings["name"]
155158

156159
return file.create_entity("IfcProfileProperties", **kwargs)
160+
161+
raise TypeError(f"Class '{settings['product'].is_a(True)}' doesn't support adding a property set.")

0 commit comments

Comments
 (0)