ConvertPropertiesToQuantities - small fix

Prevent calling add_qto if quantity set was already found in 'qtos'.
This commit is contained in:
Andrej730
2024-11-14 17:26:42 +05:00
parent 3911f51d89
commit 02621305c9
@@ -96,8 +96,10 @@ class Patcher:
has_quantity = True
if value and not has_quantity:
qto_name = self.get_qto_name(product.is_a())
qto = qtos.get(qto_name, ifcopenshell.api.pset.add_qto(self.file, product=product, name=qto_name))
qto_name = self.get_qto_name(product.is_a()) or "UnnamedQset"
qto = qtos.get(qto_name)
if qto is None:
qto = ifcopenshell.api.pset.add_qto(self.file, product=product, name=qto_name)
ifcopenshell.api.pset.edit_qto(self.file, qto=qto, properties={self.destination_quantity_name: value})
def get_qto_name(self, ifc_class: str) -> Union[str, None]: