Add support for editing IfcPhysicalComplexQuantity in edit_qto (#5335) (#5356)

* Add support for editing IfcPhysicalComplexQuantity in edit_qto (#5335)

* Fix lint-formatting issues
This commit is contained in:
Takayuki Kato
2024-09-10 13:13:57 +09:00
committed by GitHub
parent 4917cd19a2
commit 1da47d9271
@@ -154,6 +154,9 @@ class Usecase:
name = prop.Name name = prop.Name
if value is None: if value is None:
self.file.remove(prop) self.file.remove(prop)
elif prop.is_a("IfcPhysicalComplexQuantity") and isinstance(value, dict):
prop.Discrimination = value.get("Discrimination", prop.Discrimination)
ifcopenshell.api.pset.edit_qto(self.file, qto=prop, properties=value["HasQuantities"])
elif prop.is_a("IfcPhysicalSimpleQuantity"): elif prop.is_a("IfcPhysicalSimpleQuantity"):
value = value.wrappedValue if isinstance(value, ifcopenshell.entity_instance) else value value = value.wrappedValue if isinstance(value, ifcopenshell.entity_instance) else value
prop[3] = float(value) prop[3] = float(value)
@@ -164,6 +167,13 @@ class Usecase:
for name, value in self.settings["properties"].items(): for name, value in self.settings["properties"].items():
if value is None: if value is None:
continue continue
if isinstance(value, dict):
complex_qto = self.file.create_entity(
"IfcPhysicalComplexQuantity", Name=name, Discrimination=value["Discrimination"]
)
properties.append(complex_qto)
ifcopenshell.api.pset.edit_qto(self.file, qto=complex_qto, properties=value["HasQuantities"])
else:
property_type = self.get_canonical_property_type(name, value) property_type = self.get_canonical_property_type(name, value)
value = value.wrappedValue if isinstance(value, ifcopenshell.entity_instance) else value value = value.wrappedValue if isinstance(value, ifcopenshell.entity_instance) else value
properties.append( properties.append(