Import of CSV-based schedule of rates is now possible

This commit is contained in:
Dion Moult
2021-08-16 15:07:09 +10:00
parent 897d7a6b2d
commit 6ee0027f33
8 changed files with 130 additions and 43 deletions
@@ -16,18 +16,13 @@ class Usecase:
# TODO: support all applied value select types
value = self.file.createIfcMonetaryMeasure(value)
elif name == "UnitBasis":
self.remove_existing_unit_basis()
old_unit_basis = self.settings["cost_value"].UnitBasis
if value:
value_component = self.file.create_entity(
ifcopenshell.util.unit.get_unit_measure_type(value["UnitComponent"].UnitType),
ifcopenshell.util.unit.get_unit_measure_class(value["UnitComponent"].UnitType),
value["ValueComponent"],
)
value = self.file.create_entity("IfcMeasureWithUnit", value_component, value["UnitComponent"])
if old_unit_basis and len(self.file.get_inverse(old_unit_basis)) == 0:
ifcopenshell.util.element.remove_deep(self.file, old_unit_basis)
setattr(self.settings["cost_value"], name, value)
def remove_existing_unit_basis(self):
if (
self.settings["cost_value"].UnitBasis
and len(self.file.get_inverse(self.settings["cost_value"].UnitBasis)) == 1
):
ifcopenshell.util.element.remove_deep(self.file, self.settings["cost_value"].UnitBasis)